Hej jag har en sökfunction som ser ut så här:
<form method="post" action="result.php">
<select name="metode" size="1">
<option value="fornamn">Namn</option>
<option value="efternamn">Efternamn</option>
</select>
<input type="text" name="search" size="25">
<input type="submit" value="Begin Searching!!">
</form>
sidan där resultatet vissas:
<?
$hostname = "localhost"; // Usually localhost.
$username = ""; // If you have no username, leave this space empty.
$password = ""; // The same applies here.
$usertable = "register"; // This is the table you made.
$dbName = "databas"; // This is the main database you connect to.
MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
@mysql_select_db( "$dbName") or die( "Unable to select database");
?>
<?
//error message (not found message)
$XX = "No Record Found";
$query = mysql_query("SELECT * FROM $register WHERE $metode LIKE '%$search%' LIMIT 0, 30 ");
while ($row = mysql_fetch_array($query))
{
$variable1=$row["fornamn"];
$variable2=$row["efternamn"];
print ("this is for $variable1, and this print the variable2 end so on...");
}
//below this is the function for no record!!
if (!$variable1)
{
print ("$XX");
}
//end
?>
Mitt problem är att jag vill att namnen som den hittar ska bli en länk till perssonens info sidan (varje persson har en info sida)
adressen till info sidan är:
infosida.php?id=$id&namn=$namn&varde=visa&id2=$row[namn]\
databasen som man kan hämta id,id2 och namn heter medlemar.
Jag hoppas att ni förstår hur jag menar och att någon kan hjälpa mig.........