mickisdaddy Posted January 10, 2003 Share Posted January 10, 2003 Hello all I am having a little problem. I am setting up a test server on my computer at home to test my web site before I make it live. I finally got Apache, PHP and mySQL all installed. I have a form that searches my database. When I click search it goes to the results page and says the following: Notice: Undefined variable: last in c:program filesapache groupapachehtdocsscswwwbaseballplayers.php on line 82 Notice: Undefined variable: first in c:program filesapache groupapachehtdocsscswwwbaseballplayers.php on line 82 These are the two variables that are passed from the form. This page works with no problems on my hosts server. I do have phpMyAdmin installed and working perfectly. What am I doing wrong? Is there something more that I have to install? Is there something in the httpd.conf file I have to change? Here is my config OS WinXP Pro Apache 1.3.27 PHP 4.3.0 mySQL 3.23.49 phpMyAdmin 2.2.6 Any help is greatly apreciated. Sean Wilhelm Quote Link to comment https://forums.phpfreaks.com/topic/33-apache-php-mysql-form-handling/ Share on other sites More sharing options...
effigy Posted January 10, 2003 Share Posted January 10, 2003 if the code works fine, the problem sounds like your php error reporting it set too high ( notifying you of code that isn\'t 100% perfect, but still functions fine ) check the error_reporting line in your php.ini and also look into register_globals http://www.php.net/manual/en/security.regi...sterglobals.php Quote Link to comment https://forums.phpfreaks.com/topic/33-apache-php-mysql-form-handling/#findComment-79 Share on other sites More sharing options...
mickisdaddy Posted January 10, 2003 Author Share Posted January 10, 2003 The code only works fine on my hosts server not on my test server. On my test server I get those messages then it lists all lines from that table of the database. Sean Quote Link to comment https://forums.phpfreaks.com/topic/33-apache-php-mysql-form-handling/#findComment-82 Share on other sites More sharing options...
effigy Posted January 10, 2003 Share Posted January 10, 2003 on your computer — what does the error_reporting line say in the php.ini ? Quote Link to comment https://forums.phpfreaks.com/topic/33-apache-php-mysql-form-handling/#findComment-83 Share on other sites More sharing options...
mickisdaddy Posted January 10, 2003 Author Share Posted January 10, 2003 These are the lines that are not commented out error_reporting = E_ALL; display all errors, warnings and notices display_errors = On display_startup_errors = Off log_errors = Off track_errors = Off I changed the error_reporting to E_ERROR and it gets rid of the errors about the undefined variable, but with the results I still have the same problem. The form searches by first and last name. I enter a last name to search for and the results page gives me all people no matter what name they are. I think it is a problem with processing the variables that are passed from the form. Sean Quote Link to comment https://forums.phpfreaks.com/topic/33-apache-php-mysql-form-handling/#findComment-84 Share on other sites More sharing options...
effigy Posted January 11, 2003 Share Posted January 11, 2003 can you post the code? sounds like the query is not being constructed correctly. Quote Link to comment https://forums.phpfreaks.com/topic/33-apache-php-mysql-form-handling/#findComment-86 Share on other sites More sharing options...
mickisdaddy Posted January 13, 2003 Author Share Posted January 13, 2003 Here is the form code <form method=\"post\" action=\"Baseball/players.php\"> <p>Last Name <input type=\"text\" name=\"last\"> <br> First Name <input type=\"text\" name=\"first\"> <br> <input type=\"submit\" name=\"Submit\" value=\"Submit\"> <input type=\"reset\" name=\"Submit2\" value=\"Reset\"> Then it goes to this results page <?php $db = mysql_connect(\"localhost\", \"login\", \"password\"); mysql_select_db(\"database\",$db); $result = mysql_query(\"SELECT player_id, first_name, last_name FROM players WHERE last_name LIKE \'$last%\' AND first_name LIKE \'$first%\'\", $db); echo \"<b>Here are the players that match your entry</b><p>\"; while ($myrow = mysql_fetch_row($result)) { printf(\"<a href=\'Baseball/dbtest.php3?player_id=%s&fname=%s&lname=%s\'>%s %s</a><br>\", $myrow[0], $myrow[1], $myrow[2], $myrow[1], $myrow[2]); } mysql_close($db); ?> I turned the error handling down a little and it got rid of the error, but it still gave me results of all records in the table that I am querying. The same file with no modifications works on my hosts server. It then gives me this problem on the test server on my computer that I am trying to get working. Sean Quote Link to comment https://forums.phpfreaks.com/topic/33-apache-php-mysql-form-handling/#findComment-99 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.