NLuu Posted November 10, 2009 Share Posted November 10, 2009 :'( sobbing for many days, still don't know why please Help. Why my page isn't posted correctly. In a nutshell, I have two pages, 1) is just a form another contains php with answer and if and else statement. I remember it used to work 4 years ago. Please look into the code and see what is wrong with my code? Thanks in advance, Nluu [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/181051-whats-wrong-with-my-code/ Share on other sites More sharing options...
Rommeo Posted November 11, 2009 Share Posted November 11, 2009 Your mistakes ; 1- You have not defined the post variables 2- You should start your tag with "<?php" 3- Use echo, better. Just copying the first code block which is working now : <?php $answer1=$_POST['answer1']; // $answer1 = "George W. Bush, george bush"; if ((strtolower($answer1) == "barack obama" or (strtolower($answer1) == "barack hussein obama")) ) { echo "Answer 1 is <b>correct</b> <br />"; @$score+=10; } #correct answer else { echo "1. <b>Wrong!</b> Barack Hussein Obama is the President of USA.<br />"; } #incorrect answer ?></td></tr> Do the others like this, it's gonna work.. Link to comment https://forums.phpfreaks.com/topic/181051-whats-wrong-with-my-code/#findComment-955302 Share on other sites More sharing options...
NLuu Posted November 11, 2009 Author Share Posted November 11, 2009 Rommeo - Thank you very much. I appreciate your details explanation, yes, I didn't declare variables It's been so long, I didn't use it and don't even know what had I missed. UR star... NL Link to comment https://forums.phpfreaks.com/topic/181051-whats-wrong-with-my-code/#findComment-955400 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.