zyra Posted May 24, 2012 Posted May 24, 2012 I am trying to make a multiple choice quiz,but for some reson it wont work. <div align="center"> <p> General Hood fought for which side in the Civil War? <form method="post" action="qtwo.php"> <p> <input type="radio" name="qone" value="1">Union<br> <input type="radio" name="qone" value="2">Rebel<br> <input type="radio" name="qone" value="3">Patriot<br> <br> <button type="submit"><img src="submit.png"></button> </form> </p> </div> and $_POST['qone'] = $qone; include ('head.php'); if ($qone == 2) {echo "<p> Your answer was correct!</p>";} else {echo "<p> Sorry, General Hood fought for the rebels or Confederates.</p>";}
Byron Posted May 24, 2012 Posted May 24, 2012 You've got this backwards: $_POST['qone'] = $qone; should be: $qone = $_POST['qone']; 1
zyra Posted May 25, 2012 Author Posted May 25, 2012 Thanks! I can't believe I spent hours trying to make it work when all I needed to do was switch around a couple of variables.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now