Hello All,
  I am new to PHP, and I am trying to design what I thought would be a fairly simple 
form, that queries a MYSQL database for two fields, (first, and last name). It should 
then return the entire results of the entry in the table. This part is actually 5 
  If I run the script with static entries for "first", and "last", the process work 
flawlessly (as it should). If I try using variables for the search values, I do not 
receive any results. I have tried changing the form method from post, to get, and the 
problem continues. Any help would be greatly appreciated. Thank you. The first 
grouping is the html form, the second set is the php form that actually performs the 
search. Also the username, and password are populated in the actual script, I just 
took them out for the email. Thanks again.

<head><title>Contact lookup form</title></head>
<form action="test.php" method="post">
First Name: <input type="text" name="first"><br>
Last Name: <input type="text" name="last"><br>
<input type="submit" value="lookup">

define ('mysql_host', 'localhost');
define ('mysql_user', '');
define ('mysql_pass', '');
define ('mysql_db', 'chs');

if (! mysql_connect(mysql_host, mysql_user, mysql_pass) )
    die('Failed to connect to host " ' . mysql_host . ' " . ');
    echo '' . mysql_host . '<br>';

if ($http_get_vars['first'] && $http_get_vars['last'])
   echo $http_get_vars['first'] . ' ' . $http_get_vars['last'] . '<br>';
$result=mysql_query("select * from chs where first='$first' or last='$last'");
echo "<h2 align='center'>Results</h2>";

while ($row = mysql_fetch_array($result))
&nbsp{$row['voice_mail']}&nbsp&nbsp&nbsp{$row['position']}</b> <br>";

Jeffrey Norsworthy MCP, CCNA
Network Administrator
Community Health Services

Reply via email to