[PHP-DB] Error with addition of second
Dear friends, With 4 radio buttons and php snippet, it gives desired output, however when I add second question in the html form and variable for the same like $variable =$_POST['q'] in Php snippet it gives me error. I have pasted php code when it works and when it gives error. Any guidance, please. -- Error -- --- Parse error: parse error, unexpected ',' in C:\HOME\doctorbush\quiz.php on line 10 -- - php snnipet, code which it works with Q-1 --- ?php $variable = $_POST['R'] ; if ($variable == 3) { echo Score 1; } else { echo Score 0; }; ? -- php snippet when it gives error with addition of second question ?php $variable = $_POST['R'] ; $secondvar = $_POST['q'] ; if ($variable == 3, $secondvar== 4) { echo Score 1; } else { echo Score 0; ? -- Html form code --- html head title/title /head body form method=POST action=quiz.php Q-1)Law of diminished return is ;br input type=radio value=4 checked name=R Medical concept BR input type=radio value=3 checked name=R Economic BR input type=radio value=2 checked name=R Agriculture BR input type=radio value=1 checked name=R Computers BR p Q-2)Once there is inflation ;br input type=radio value=4 checked name=q Government has to print extra currency BR input type=radio value=3 checked name=q Inflation is good for economy BR input type=radio value=2 checked name=q Inflation is diastrous for economyBR input type=radio value=1 checked name=q Inflation is not of much concern BR INPUT TYPE=SUBMIT NAME=submit VALUE=See Score /form/body /html
Re: [PHP-DB] Error with addition of second
--- [EMAIL PROTECTED] wrote: Dear friends, With 4 radio buttons and php snippet, it gives desired output, however when I add second question in the html form and variable for the same like $variable =$_POST['q'] in Php snippet it gives me error. I have pasted php code when it works and when it gives error. Did you read the error? It's pretty explicit. Any guidance, please. -- Error -- --- Parse error: parse error, unexpected ',' in C:\HOME\doctorbush\quiz.php on line 10 -- - php snnipet, code which it works with Q-1 --- ?php $variable = $_POST['R'] ; if ($variable == 3) { echo Score 1; } else { echo Score 0; }; ? -- php snippet when it gives error with addition of second question ?php $variable = $_POST['R'] ; $secondvar = $_POST['q'] ; if ($variable == 3, $secondvar== 4) { This is not a valid PHP statement. Do you mean AND, or OR? the error said line 10, right? This must be line 10. There is only one comma in it. Depending on what you mean, either use: 1- if ($variable == 3 AND $secondvar== 4) { or 2 if ($variable == 3 OR $secondvar== 4) { echo Score 1; } else { echo Score 0; ? -- Html form code --- html head title/title /head body form method=POST action=quiz.php Q-1)Law of diminished return is ;br input type=radio value=4 checked name=R Medical concept BR input type=radio value=3 checked name=R Economic BR input type=radio value=2 checked name=R Agriculture BR input type=radio value=1 checked name=R Computers BR p Also, you shouldn't have all of the radio buttons associated with the same variable checked. In fact, if this is a quiz, none should be checked. And this last question doesn't even make sense :-) Q-2)Once there is inflation ;br input type=radio value=4 checked name=q Government has to print extra currency BR input type=radio value=3 checked name=q Inflation is good for economy BR input type=radio value=2 checked name=q Inflation is diastrous for economyBR input type=radio value=1 checked name=q Inflation is not of much concern BR INPUT TYPE=SUBMIT NAME=submit VALUE=See Score /form/body /html = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Error with addition of second
It doesn't like the }; On Sat, 2004-09-18 at 19:04, Mark wrote: --- [EMAIL PROTECTED] wrote: Dear friends, With 4 radio buttons and php snippet, it gives desired output, however when I add second question in the html form and variable for the same like $variable =$_POST['q'] in Php snippet it gives me error. I have pasted php code when it works and when it gives error. Did you read the error? It's pretty explicit. Any guidance, please. -- Error -- --- Parse error: parse error, unexpected ',' in C:\HOME\doctorbush\quiz.php on line 10 -- - php snnipet, code which it works with Q-1 --- ?php $variable = $_POST['R'] ; if ($variable == 3) { echo Score 1; } else { echo Score 0; }; ? -- php snippet when it gives error with addition of second question ?php $variable = $_POST['R'] ; $secondvar = $_POST['q'] ; if ($variable == 3, $secondvar== 4) { This is not a valid PHP statement. Do you mean AND, or OR? the error said line 10, right? This must be line 10. There is only one comma in it. Depending on what you mean, either use: 1- if ($variable == 3 AND $secondvar== 4) { or 2 if ($variable == 3 OR $secondvar== 4) { echo Score 1; } else { echo Score 0; ? -- Html form code --- html head title/title /head body form method=POST action=quiz.php Q-1)Law of diminished return is ;br input type=radio value=4 checked name=R Medical concept BR input type=radio value=3 checked name=R Economic BR input type=radio value=2 checked name=R Agriculture BR input type=radio value=1 checked name=R Computers BR p Also, you shouldn't have all of the radio buttons associated with the same variable checked. In fact, if this is a quiz, none should be checked. And this last question doesn't even make sense :-) Q-2)Once there is inflation ;br input type=radio value=4 checked name=q Government has to print extra currency BR input type=radio value=3 checked name=q Inflation is good for economy BR input type=radio value=2 checked name=q Inflation is diastrous for economyBR input type=radio value=1 checked name=q Inflation is not of much concern BR INPUT TYPE=SUBMIT NAME=submit VALUE=See Score /form/body /html = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Error with addition of second
echo Score 1; You'll get an error here too...missing quotes () On Sat, 18 Sep 2004 22:07:37 -0700, Cole S. Ashcraft [EMAIL PROTECTED] wrote: It doesn't like the }; On Sat, 2004-09-18 at 19:04, Mark wrote: --- [EMAIL PROTECTED] wrote: Dear friends, With 4 radio buttons and php snippet, it gives desired output, however when I add second question in the html form and variable for the same like $variable =$_POST['q'] in Php snippet it gives me error. I have pasted php code when it works and when it gives error. Did you read the error? It's pretty explicit. Any guidance, please. -- Error -- --- Parse error: parse error, unexpected ',' in C:\HOME\doctorbush\quiz.php on line 10 -- - php snnipet, code which it works with Q-1 --- ?php $variable = $_POST['R'] ; if ($variable == 3) { echo Score 1; } else { echo Score 0; }; ? -- php snippet when it gives error with addition of second question ?php $variable = $_POST['R'] ; $secondvar = $_POST['q'] ; if ($variable == 3, $secondvar== 4) { This is not a valid PHP statement. Do you mean AND, or OR? the error said line 10, right? This must be line 10. There is only one comma in it. Depending on what you mean, either use: 1- if ($variable == 3 AND $secondvar== 4) { or 2 if ($variable == 3 OR $secondvar== 4) { echo Score 1; } else { echo Score 0; ? -- Html form code --- html head title/title /head body form method=POST action=quiz.php Q-1)Law of diminished return is ;br input type=radio value=4 checked name=R Medical concept BR input type=radio value=3 checked name=R Economic BR input type=radio value=2 checked name=R Agriculture BR input type=radio value=1 checked name=R Computers BR p Also, you shouldn't have all of the radio buttons associated with the same variable checked. In fact, if this is a quiz, none should be checked. And this last question doesn't even make sense :-) Q-2)Once there is inflation ;br input type=radio value=4 checked name=q Government has to print extra currency BR input type=radio value=3 checked name=q Inflation is good for economy BR input type=radio value=2 checked name=q Inflation is diastrous for economyBR input type=radio value=1 checked name=q Inflation is not of much concern BR INPUT TYPE=SUBMIT NAME=submit VALUE=See Score /form/body /html = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php