I am very new to php and need help understanding how to set up this form.
Form page: radio buttons with yes/no answer to 10 questions.
Results page: if any questions answered "no" then the "suggestion page header" needs to display and for each "no" answer the "suggestion text" needs to display. If all the answers are "yes" then "well done header and text" display.
I have assigned the form & radios like so:
<form action="my_file.php" method="post" name="my_form">
<input type="radio" name="q1" value="1">
<input type="radio" name="q1" value="2">
<input type="radio" name="q2" value="1">
<input type="radio" name="q2" value="2">
so value 1 is yes and value 2 is no....and I thought the php should on the my_file.php should look like this:
if $_POST['q1']=='2'{
echo " <p>suggestion text for question 1 </p>\n";
elseif $_POST['q2']=='2'{
echo " <p>suggestion text for question 2 </p>\n";
How do I set the first if statement to see if every question answered has the value 1 to return the "well done" text , else echo the "suggestion header " and then start the individual question echos on the "suggestion text". Is it possible to use the code like this:
if $_POST['value']=='1'{
echo " Well Done Header and Text \n";
I have done a lot of searching online and in books and I am not even sure that this is the best set up for my form. Is it more appropriate to use a switch on this page?
I am also wondering about using <p> or \n. The echo "suggestion text" in some cases is several paragraphs so I assume I need to keep the <p> in place. If the <p> are in place do I then need to add the \n? Since the echo text is so long, I am better off using INCLUDE.
I am basically lost at this point and will greatly appreciate any help offered.
Thanks.