I have a html with a form pointing to a php file that is supposed to show values from the row which relates to the imput value from the form.
Below is the code I am using for the form:
PHP Code:
<form action="customer.php" method="get"> <input type="text" name="reg" /> <input type="submit" /> </form>
and the PHP file is:
PHP Code:
<?php $host = 'localhost'; $user = 'gahrefri_custom'; $pass = 'password'; $dbname = 'gahrefri_gahcustomer'; $tablename = 'gahcustomer'; $con = mysql_connect("$host","$user","$pass"); if (!$con) { die('Could not connect... ' . mysql_error()); } mysql_select_db("$dbname", $con); $result = mysql_query("SELECT * FROM $tablename WHERE Reg No='reg'"); { echo $row['Reg No'] . " " . $row['Customer'] . " " . $row['Contract'] . " " . $row['Comments']; } ?>
The 'Reg No', 'Customer', 'Contract', and 'Comments', relates to the header of each column in the MySQL database.
Can anyone point firmly me in the right direction?
|