drrqwokuz71031449 2011-04-13 21:01
浏览 10
已采纳

PHP自动转发

If my PHP page contains:

<input type="submit" name="add1" value="Add Item">
<input type="submit" name="chgprice" value="Change Price">
<input type="submit" name="delete" value="Delete Item">
<input type="submit" name="main" value="Main">

as well as:

<?PHP
if($_POST['main'] == "Main"){
    header('Location: http://hidden.edu/~test/457/1/index.php');
}elseif($_POST['dspphp'] == "Display Source" && $_POST['srcpw'] == "srcpass"){
    $_SESSION['srcsite'] = "store.php";
    header('Location: http://hidden.edu/~test/457/1/source.php');
}elseif($_POST['add1'] == "Add Item"){
    header('Location: http://hidden.edu/~test/457/1/additem.php');
}elseif($_POST['chgprice'] = "Change Price"){
    header('Location: http://hidden.edu/~test/457/1/changeprice.php');
}
?>

It autoforwards to changeprice.php. I just don't understand why it autoforwards there, and doesn't to the others. I have tried moving it around in the page but nothing seems to help. I can open the page directly, and it works fine. If I change changeprice.php to, say, index.php it autoforwards there instead. Any ideas?

Thanks for the input.

  • 写回答

2条回答 默认 最新

  • doubi6215 2011-04-13 21:18
    关注

    Change:

    }elseif($_POST['chgprice'] = "Change Price"){
    

    to:

    }elseif($_POST['chgprice'] == "Change Price"){
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?