Jump to content

What's wrong with my code


NLuu

Recommended Posts

:'( 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

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..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.