Hi,
I do the search function, when enter the search keyword and click button find, the lists of item display.
But the problem is i would like to do something like this, when i click one of the list items, it will redirect to another page that display details of the clicked items.
Can someone help me please? Thank you :)
Below the code that i had done so far
I do the search function, when enter the search keyword and click button find, the lists of item display.
But the problem is i would like to do something like this, when i click one of the list items, it will redirect to another page that display details of the clicked items.
Can someone help me please? Thank you :)
Below the code that i had done so far
Code:
<?php mysql_connect ("localhost", "root","") or die (mysql_error()); mysql_select_db ("ware1"); $term = $_POST['term']; $sql = mysql_query("select * from equip_ments where serial_num like '%$term%' or component_1 like '%$term%'"); while ($row = mysql_fetch_array($sql)){ ?> <?php $id=$row[ 'product_id']; $component =$row['component_1']; $serialnum=$row['serial_num']; $ID=$row['product_id']; //echo 'Product ID: '.$ID; //echo '<br/> Serial Number: '.$row['serial_num']; //echo '<br/> Item: '.$row['item_1']; //echo '<br/> Date In: '.$row['date_in']; //echo '<br></br>'; //echo "<ul>\n"; echo "<li>" . "<a href=\"search1.php?id=$id\">" .$id . " " . $serialnum . "</a></li>\n"; echo "</ul>"; } if(isset($_GET['id'])){ $contactid=$_GET['id']; //connect to the database $db=mysql_connect ("localhost", "root", "") or die ('I cannot connect to the database because: ' . mysql_error()); //-select the database to use $mydb=mysql_select_db("ware1"); //-query the database table $sql="SELECT * FROM equip_ments WHERE product_id=" . $contactid; //-run the query against the mysql query function $result=mysql_query($sql); //-create while loop and loop through result set while($row=mysql_fetch_array($result)){ $component =$row['component_1']; $serialnum=$row['serial_num']; $ID=$row['product_id']; //$Email=$row['Email']; //-display the result of the array echo "<ul>\n"; echo "<li>" . $component . " " . $serialnum . "</li>\n"; echo "<li>" . $ID . "</li>\n"; //echo "<li>" . "<a href=mailto:" . $Email . ">" . $Email . "</a></li>\n"; echo "</ul>"; } } ?>
Comment