Hi, I am working on a survey and have a problem creating a condition. I'm new to php.
I have a form that gives the user two options where each of them would take him to different pages.
the form is something like this.
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
<form method="post" name="form2" action="<?php echo $editFormAction; ?>">
<input type="radio" name="QUESTION" value="1">
Yes
<input type="radio" name="QUESTION" value="0">
No
<input name="submit" type="submit" value="Continue </form>
on the same page I have a condition like this but doesn't work:
if ($QUESTION = 1) {
$insertGoTo = "page1.php";
} else {
$insertGoTo = "page2.php";
}
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
When I click any of the two options it takes me to page1.php.
This is very urgent, any help will be very apprecited.
Thanks, sbayter
I have a form that gives the user two options where each of them would take him to different pages.
the form is something like this.
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
<form method="post" name="form2" action="<?php echo $editFormAction; ?>">
<input type="radio" name="QUESTION" value="1">
Yes
<input type="radio" name="QUESTION" value="0">
No
<input name="submit" type="submit" value="Continue </form>
on the same page I have a condition like this but doesn't work:
if ($QUESTION = 1) {
$insertGoTo = "page1.php";
} else {
$insertGoTo = "page2.php";
}
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
When I click any of the two options it takes me to page1.php.
This is very urgent, any help will be very apprecited.
Thanks, sbayter