Johanafm, ok thanks for that, but I still dont have it working for me. This is the full code I have, can you see anything wrong .....
I'm getting an error as follows:
Parse error: syntax error, unexpected $end in E:\domains\g\gmts.info\user\htdocs\dbasetest\search2\search_display.php on line 65
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Search Contacts</title>
<STYLE>
A {
text-decoration: none;
}
</STYLE>
</head>
<body>
<h3>Search Details</h3>
<p>search by the Tcode</p>
<form method="post" action="search_display.php?go" id="searchform">
<input type="text" name="name">
<input type="submit" name="submit" value="Search">
</form>
<?php
if(isset($POST['submit'])){
if(isset($GET['go'])){
if(preg_match("/[A-Z | a-z]+/", $POST['name'])){
$name=$POST['name'];
//connect to the database
$db=mysql_connect ("", "", "") or die ('I cannot connect to the database because: ' . mysql_error());
//-select the database to use
$mydb=mysql_select_db("");
$sql="SELECT ID, Tcode, Xcode, Url, ImageURL
FROM Tickets WHERE Tcode LIKE '%$name%' OR Xcode LIKE '%$name%'";
$result=mysql_query($sql);
/ Showing links still makes if several rows are returned, so that the user can choose
which one is relevant /
if (mysql_num_rows($result) > 1) {
while($row = mysql_fetch_array($result))
{
$Tcode =$row['Tcode'];
$Xcode=$row['Xcode'];
$Url=$row['Url'];
$ID=$row['ID'];
$ImageUrl = $row['ImageURL'];
echo "<li><a href=\"$Url\">$Tcode $Xcode $Url
<img path=\"$ImageUrl\" height=\"24\" border=\"0\" /></a></li>\n";
}
}
elseif ($row = mysql_fetch_array($result)) {
header('HTTP/1.1 302 Found');
header("Location: $Url");
exit;
}
else {
}
?>
</body>
</html>