我有關於在PHP
重定向的問題,我有2頁
- 第一頁的索引
- 兩頁的過程編輯或edit.php
如何在條件重定向用PHP
我的問題是..
如果我點擊編輯,他肯定在edit.php和如果我點擊保存edit.php
如果我對重定向
header('location:index.php');
如何找回或重定向到索引,但仍處於logical2或
$_POST['select']=='2'
這是我的代碼:
<form action='' methode='post'>
<select name='select'>
<option value='1'>example1</option>
<option value='2'>example2</option>
</select>
</form>
<?php
if($_POST['select']=='1')
{
echo"<a href='?page=edit&id=$r[id]'>Edit</a>";
}
elseif($_POST['select']=='2')
{
echo"<a href='?page=edit&id=$r[id]'>Edit</a>";
}
else
{
echo"please select";
}
?>
你需要在$ r [id]'的周圍放置大括號('{}')。除此之外,我不知道你在問什麼。 – worldofjr 2014-09-30 02:59:32
hy worldofir對不起,如果我的代碼不完整,因爲它只是例如,但我的問題是更像像頭('location:index.php')重定向;但如何直接索引,但仍在條件$ _POST ['select'] =='2' – badruz 2014-09-30 03:05:05