Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Need help with PHP BUTTONS!

$
0
0

Before I start I am new to this so if i have left anything out please do tell  ::) .  

I am creating a quiz which is multiple answer. I am using Submit buttons. 

I have tried multiple codes such as $_GET and $_Post. I am trying to link the buttons so if the user selects the correct answer it outputs a message. I am aware of If statements but get errors  :confused:

 

My Attempt so far: 

 

<html>
<head>
<title>A BASIC HTML FORM</title>
 
<?PHP
 
echo '<input type="Radio" name = "4"/>';
echo '<input type="Radio" name = "2"/>';
 
 
$correct=4;
 
$correct=$_POST['4'];
 
if($correct == "4" ){ 
 
echo "Correct Awnser";
 
}
 
else { 
 
echo "Wrong Awnser";
 
}
 
 
?> 
 
 
PS: I am also using http://phpfiddle.org/ to run my code. 
 
Many Thanks

 

 

 


Viewing all articles
Browse latest Browse all 13200

Latest Images

Trending Articles



Latest Images