Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form with If condition doesn't work 1

Status
Not open for further replies.

sbayter

IS-IT--Management
Nov 14, 2002
95
CO
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=&quot;post&quot; name=&quot;form2&quot; action=&quot;<?php echo $editFormAction; ?>&quot;>
<input type=&quot;radio&quot; name=&quot;QUESTION&quot; value=&quot;1&quot;>
Yes
<input type=&quot;radio&quot; name=&quot;QUESTION&quot; value=&quot;0&quot;>
No
<input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;Continue </form>

on the same page I have a condition like this but doesn't work:

if ($QUESTION = 1) {
$insertGoTo = &quot;page1.php&quot;;
} else {
$insertGoTo = &quot;page2.php&quot;;
}

if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? &quot;&&quot; : &quot;?&quot;;
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf(&quot;Location: %s&quot;, $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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top