Wednesday, 11 September 2013

header location not working properly php

header location not working properly php

can some point me out why the below isn't working? It only redirects to
the first location even though I choose different radio buttons.
if(isset($_POST['submit'])){
if(!empty($_POST['electronics'])){
if($_POST['electronics'] = "camera"){
header("location: camera.php"); exit();
}
if($_POST['electronics'] = "cell"){
header("location: cellphones.php"); exit();
}
if($_POST['electronics'] = "cable"){
header("location: cables.php"); exit();
}
if($_POST['electronics'] = "tv"){
header("location: tv.php"); exit();
}
}
<form action="" method="post">
<input type="radio" name="electronics" value="cell"/>
<input type="radio" name="electronics" value="camera"/>
<input type="radio" name="electronics" value="cable"/>
<input type="radio" name="electronics" value="tv"/>
<input type="submit" name="submit">
</form>

No comments:

Post a Comment