Hi,

I am new in PHP and I am trying to work with a simple if statement with 3 radio buttom where each one go to a different page. I am not sure if I am doing the correct way. Can anyone help me with an if statement?


Here is what I have in my code:
index.php

<form name="" method="post" action="evaluate.php">
<input name="yesno" type="radio" value="yes"></td>
<td>Yes</td>
<input name="yesno" type="radio" value="no"></td>
<td>No</td>
<input name="yesno" type="radio" value="other"></td>
<td>No</td>
<input type="submit" name="Submit" value="Submit">
</form>

------evaluate.php-----
<?php
$create = new result();
$create->AddDBParam('yesno',$_POST[yesno]);
$createResult=$create->FMView();
$yesno=$_POST;
?>
<?php
if($yesno == "yes")
{
 header("Location: test01.php " );
}
if($yesno == "no")
{
 header("Location: test02.php " );
}
if($yesno == "other")
{
 header("Location: test03.php " );
}
?>

thank you,

msei :-|

<form name="" method="post" action="evaluate.php">
<input name="yesno" type="radio" value="yes"></td>
<td>Yes</td>
<input name="yesno" type="radio" value="no"></td>
<td>No</td>
<input name="yesno" type="radio" value="other"></td>
<td>Other</td>
<input type="submit" name="Submit" value="Submit">
</form>

<?php
if (isset($_POST))
{
$yesno=$_POST;
if($yesno == "yes")
{
header("Location: test01.php " );
}
if($yesno == "no")
{
header("Location: test02.php " );
}
if($yesno == "other")
{
header("Location: test03.php " );
}
}
?>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.