2 Replies - 878 Views - Last Post: 19 April 2011 - 02:18 PM Rate Topic: -----

#1 RunningBiker  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 18-April 11

Questionnaire branching

Posted 18 April 2011 - 06:23 PM

Completing a series of questionnaires and need them to branch for the last couple of questionnaires that are specific to men or women. Based on online conditionals, I thought I could put the form submissions in like so:

<?php
if ($gender==1){
	<form id="form" method="post" action="womens_questionnaire.php5">
}else {
	<form id="form" method="post" action="mens_questionnaire.php5">
}
?>



but this causes the php5 to not even display. Any examples or guidance? I cannot find an example more specific to what I'm trying to do.

Is This A Good Question/Topic? 0
  • +

Replies To: Questionnaire branching

#2 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 943
  • View blog
  • Posts: 2,353
  • Joined: 15-February 11

Re: Questionnaire branching

Posted 18 April 2011 - 06:29 PM

It would be better to just incorporate a hidden field into your form. Set the value to either Male or Female then allow your PHP script to take the proper course of action depending on it's value.
Was This Post Helpful? 0
  • +
  • -

#3 RunningBiker  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 18-April 11

Re: Questionnaire branching

Posted 19 April 2011 - 02:18 PM

Progress. the page now loads with the code, but the conditional is not active (always slots "else") even when the variable is explicitly defined in the page or in the php in the page.

<?php
	if ($gender==1){
	    echo"<form id='form' method='post' action='women.php5'>";
	} else {
	    echo"<form id='form' method='post' action='men.php5'>";
	}
?>


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1