more newbie help
Posted: Wed Sep 07, 2005 5:53 am
ok - last one for a while I promise - my brain is tired and I just cant seem to think!
this is some code:
the aim is for me to be able to search for a record using the form, and searching by "contact_name" and dispaly the record. I can get that bit. What I then want it to be able to have the result linking to an editdetails.php passing on the uid
i have tried to play around with things such as
but i just cant figure it out!
thanks in advnace for the help - I know i really should go away and learn some more ir read the book! but times precious at the moment!
this is some code:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Car Test - Add Entry</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form enctype="multipart/form-data" method="post" action="<?php echo $PHP_SELF ?>">
Contact Name<br>
<input type="Text" name="contact_name" size="25">
<br><br>
<input type="submit" name="submit" value="Search">
</form>
<?php
if ($submit) {
$username="xxxx";
$password="xxxx";
$database="xxxx";
$contact_name=$_POST['contact_name'];
mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query("SELECT * FROM newsstuf_usedcars
WHERE contact_name='$contact_name'") or die(mysql_error());
$row = mysql_fetch_array( $result );
echo $row['uid']." - ".$row['contact_name']." - ".$row['car_make'];
}
mysql_close();
?>
</body>
</html>i have tried to play around with things such as
Code: Select all
echo( "<a href='details.php?id='uid'>'contact_name', 'car_make'<br></a>" );thanks in advnace for the help - I know i really should go away and learn some more ir read the book! but times precious at the moment!