VitoCorleone
Programmer
i have a form where a user can search the database STAFF, here they insert a staff number and press submit.
the next page is using the $_Post to retrieve that value on the previous page and display the records. however its not working.
Can you help? Any sites?
Here is the code on my 2nd page:
<?php
// Database connection variables
$dbServer = "localhost";
$dbDatabase = "dreamhome";
$dbUser = "root";
$dbPass = "harry";
$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
$result = mysql_query("SELECT * FROM staff WHERE staff_no = '" . $_POST['staffno'] ."'",$db);
echo "<table border=1>\n";
echo "<tr><td>staff Number</td><td>name</tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s %s</td><td>%s</td></tr>\n",
$myrow[1], $myrow[2], $myrow[3]);
}
echo "</table>\n";
?>
the next page is using the $_Post to retrieve that value on the previous page and display the records. however its not working.
Can you help? Any sites?
Here is the code on my 2nd page:
<?php
// Database connection variables
$dbServer = "localhost";
$dbDatabase = "dreamhome";
$dbUser = "root";
$dbPass = "harry";
$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
$result = mysql_query("SELECT * FROM staff WHERE staff_no = '" . $_POST['staffno'] ."'",$db);
echo "<table border=1>\n";
echo "<tr><td>staff Number</td><td>name</tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s %s</td><td>%s</td></tr>\n",
$myrow[1], $myrow[2], $myrow[3]);
}
echo "</table>\n";
?>