Hello, I am newb with php
I got a strange message error, that is:
Notice: Use of undefined constant y - assumed 'y' in /home/www/healthforum.uib.no/htdocs/ohcsurvey/survey/sp1.php on line 139
I am making a survey where the user , by cliking radio buttons, can choose between yes or no to a question. for example:
<u>Do you agree or not?</u><br/>
<b><input type="radio" name="c1" value="y" />I do <br/>
<input type="radio" name="c1" value="n" />I don't</b>
(the forms are not on the same page but are linked to it properly)
The yes is transformed by 1 and the no is transformed by 0 with this code:
139) if ($a1 == y) { $a1 = 1; }
140) else { $a1 = 0; }
141)
142) if ($b1 == y) { $b1 = 1; }
143) else { $b1 = 0; }
144)
145) if ($c1 == y) { $c1 = 1; }
146) else { $c1 = 0; }
147) if ($d1 == y) { $d1 = 1; }
148) else { $d1 = 0; }
153) // put it in the db
157) $insertInf = "UPDATE survey SET a1 = '$a1', b1 = '$b1', c1 = 158) '$c1',d1 = '$d1'
159) WHERE username = '$username'";
160) $ins = mysql_query($insertInf) or die('Erreur: Vos donnees 161) ne nous sont pas parvenues');
162) header ('Location:sp2.php');
Although the error, I got the result without problem in my database.
However, It prevents me from going to the next page of the survey as this warning attests:
Warning: Cannot modify header information - headers already sent by (output started at /home/www/healthforum.uib.no/htdocs/ohcsurvey/survey/sp1.php:142) in /home/www/healthforum.uib.no/htdocs/ohcsurvey/survey/sp1.php on line 162
Could you help me with this ?