[KLUG Members] php Q

Lunitix lunitix at earthlink.net
Sat Nov 6 22:44:22 EST 2004


Ok.  I am doing another *AMP (Mac/Linux-Apache-MySQL-PHP) project. 
Basically I've taken working code from my previous project, which only 
seems to work on my Mac (but that's another Q), and have inserted new 
variables and database but the data flow from page to page to database 
remains the same.  My issue here is that the entered data does not seem 
to be getting to the 2nd page or the database.  Any thoughts would be 
welcomed.

Precursors - I know I have used the word "jeopardy" as the username, 
password, and database name.  Sorry but while I'm working this out, I 
like to keep particulars simple (at least for me).  And the error code 
in the second page I modified from the earlier project in hopes it would 
lead me somewhere, but all to no avail.

----Page 1----

<form action=singjeopsubmit.php method=GET>
         Category Title
         <br>
         <input max="255" size="50" value="" name="jeop_category" 
type="text">
         <br>
         <p>
         2 Point Question
         <br>
         <input max="255" size="100" value="" name="jeop_ques2" type="text">
         <br>
         <font size="2">Maximum 255 Characters</font>
         </p>
		 <p>
         2 Point Answer
         <br>
         <input max="255" size="100" value="" name="jeop_ans2" type="text">
         <br>
         <font size="2">Maximum 255 Characters</font>
         </p>
<br>
         <input value="Submit Category" name="singjeopsubmit" type="submit">


----Page 2-----

<?php
$_GET['$jeop_category'];
$_GET['$jeop_ques2'];$_GET['$jeop_ans2'];
$link=mysql_connect ("traveller.local", "jeopardy", "jeopardy");
    if (!$link) {
      die("Your database is screwed: " . mysql_error());
     }
mysql_select_db ("jeopardy");
$query="INSERT INTO single ( category, ques2, ans2)
VALUES ( '$_GET[jeop_category]', '$_GET[jeop_ques2]', '$_GET[jeop_ans2]' )
";
$result=mysql_query($query, $link);
    if (!$result) {
      die("Your data is hosed: " .mysql_error());
}
print ("Category")
print ($jeop_category);
print (" ");

print ("2 Point Question")
print ($jeop_ques2);
print (" ");
print ($jeop_ans2);
print (" ");
print ("<p>");
print ("Single Jeopardy Category, Questions, and Answers submitted");
?>


More information about the Members mailing list