Jump to content

thecard

Members
  • Posts

    104
  • Joined

  • Last visited

    Never

Everything posted by thecard

  1. I fixed it a bit...It now moves onto the next word but when it tests to see if you got it right, it tests it for the next word. SO to make it say "RIGHT" you have to type the answer to the next question in! Here it is: <? include('header.php'); ?> <tr> <td> <div id="form"><form name="ad" action="index.php" method="POST"> <table width="50%" border="0px" cellspacing="0" cellpadding="5" align="center"> <p align="center"><font size="15px"><b> <? if ($_POST['id'] == '') { $id = 1; } else { $id = $_POST['id']+1; } require('config.php'); $sql = "SELECT * FROM tb_vb1 WHERE id='$id'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $lat = $row["lat"]; $eng = $row["eng"]; mysql_close($con); echo "What is the English for $lat?"; if ($_POST['eng'] == $eng) { echo ' RIGHT!'; } else { echo ' Wrong!'; } ?> </b></font></p> <tr> <td width="100%" align="center" valign="bottom"><input type="text" name="eng" size="40" class="field" value="<? echo "$eng" ?>"></td> </tr> <input type=hidden value="<? echo "$id"; ?>" name="id" > <tr> <td width="100%" align="center" valign="bottom"><input type=submit value="Submit Your Answer" name="submit" class="form"> </td> </tr> </table> </tr> </td> </table> </form> </body> </html> Thanks...
  2. I'm trying to work it now, but am still confused! What should I write instead of if (isset($_POST))... ?
  3. The PROBLEM is that it never moves onto the next word in the database. It sets $id to the right value, but does not echo the appropriate row related to $id. Sorry DarkWater, what do you mean?
  4. I am making a website to test people on their latin. I have a few words in a database, but I can't get the tester to work properly! It checks your answer against the database to see if its correct and states otherwise but does not move on to the next word. You can view it as it is at the moment here: www.teapay.com Here's the code: <? include('header.php'); ?> <tr> <td> <div id="form"><form name="ad" action="index.php" method="POST"> <table width="50%" border="0px" cellspacing="0" cellpadding="5" align="center"> <p align="center"><font size="15px"><b> <? if (isset($_POST)) { $id = 1; } else { $id = $_POST['id']+1; } include('config.php'); $sql = "SELECT * FROM tb_vb1 WHERE id='$id'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $lat = $row["lat"]; mysql_close($con); echo "What is the English for $lat?"; include('config.php'); $sql = "SELECT * FROM tb_vb1 WHERE id='$id'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $eng = $row["eng"]; mysql_close($con); if ($_POST['eng'] == $eng) { $alex = true; echo 'Right!'; $id = $_POST['id']+1; } else { $alex = false; echo 'Wrong!'; $id = $_POST['id']; } echo "$id"; ?> </b></font></p> <tr> <td width="100%" align="center" valign="bottom"><input type="text" name="eng" size="40" class="field"</td> </tr> <input type=hidden value="<? echo "$id"; ?>" name="id"> <tr> <td width="100%" align="center" valign="bottom"><input type=submit value="Submit Your Answer" name="submit" class="form"> </td> </tr> </table> </tr> </td> </table> </form> </body> </html> Thanks for your help!
×
×
  • 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.