Hi Im have aproblem with a site im trying to design. What Im trying to do is when you click on an image it links to another page and displays data that is relevent to its self.
The images are stored in the mysql data base under a colum called thumb and what im trying to make happen is when you click on the image it submittes its thumb name with a form feature and I can use the post meathod to recive it on another page and display the rest of the data stored in its row.
The below code sort of works, the only problem is that is selects the last item in the data base with the name gibson and the data in its row. I cant get it to select anything else.
I could be going about this complitly the wrong way...
Any help would be great
this is the code to send;
<form action='proinfo .php' target ='mainFrame' method='post' >
<?php
$result = mysql_query("SE LECT * FROM stocklist WHERE make LIKE 'gibson' ");
while($row = mysql_fetch_arr ay($result))
{
//$proid = $row['thumb'];
$thumbpic = $row['thumb'];
echo "<input type='image' src = '$thumbpic'/>";
echo "<input type='hidden' name ='proid' value ='$thumbpic'/>";
}
?>
This is the code to display what has been sent;
$searchd = $_POST["proid"];
$sql = "SELECT * FROM stocklist WHERE thumb = '$searchd'";
$result = mysql_query($sq l) or die(mysql_error ());
while ($row = mysql_fetch_arr ay($result))
{
echo $row['title']." ".$row['image']." ".$row['images'];
echo "<br />";
}
The images are stored in the mysql data base under a colum called thumb and what im trying to make happen is when you click on the image it submittes its thumb name with a form feature and I can use the post meathod to recive it on another page and display the rest of the data stored in its row.
The below code sort of works, the only problem is that is selects the last item in the data base with the name gibson and the data in its row. I cant get it to select anything else.
I could be going about this complitly the wrong way...
Any help would be great
this is the code to send;
<form action='proinfo .php' target ='mainFrame' method='post' >
<?php
$result = mysql_query("SE LECT * FROM stocklist WHERE make LIKE 'gibson' ");
while($row = mysql_fetch_arr ay($result))
{
//$proid = $row['thumb'];
$thumbpic = $row['thumb'];
echo "<input type='image' src = '$thumbpic'/>";
echo "<input type='hidden' name ='proid' value ='$thumbpic'/>";
}
?>
This is the code to display what has been sent;
$searchd = $_POST["proid"];
$sql = "SELECT * FROM stocklist WHERE thumb = '$searchd'";
$result = mysql_query($sq l) or die(mysql_error ());
while ($row = mysql_fetch_arr ay($result))
{
echo $row['title']." ".$row['image']." ".$row['images'];
echo "<br />";
}
Comment