Im a newbie in PHP and I want to create a simple webpage app for my website, I was able to produce this page base on a tutorial here.

  $con = mysql_connect("localhost","*****","*****");
  if (!$con)
   die('Could not connect: ' . mysql_error());

mysql_select_db("*****", $con);

$result = mysql_query("SELECT * FROM products");

echo "<table border='1'>

while($row = mysql_fetch_array($result))

  echo "<tr>";
  echo "<td>" . $row['name'] . "</td>";
  echo "<td>" . $row['classification'] . "</td>";
  echo "<td><input type='checkbox' name='{number[]}' value='{$row['prodID']}' /></td>";

  echo "</tr>";
echo "</table>";






<form name="form1" method="post" action="result_page.php"> 

<input type="submit"  name="Submit"      value="Submit"> 



heres the image of the page : Click Here

but my problem is how to create a result_page.php to show the selected entries or data base on the selected checkbox so i can create a comparison page. I have this as being my result_page.php but nothing is showing up. I know Im doing something wrong but I cant find out. What Im trying to acheive is to be able to produce a page something like this: Click Here

4 Years
Discussion Span
Last Post by philjon-aris

by the way heres my my result_page.php which is not working:


$host = 'localhost';                
$user = '******';       
$pass = '******';       
$dbname = '******';         
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().":  ".mysql_error()."<BR>"); 

$sql = "SELECT * FROM products WHERE prodID IN ("; 

foreach ($_POST['number'] as $product) $sql .= "'" . $product . "',";

$sql = substr($sql,0,-1) . ")"; 

$result = mysql_query($sql); 

while ($myrow = mysql_fetch_array($result))

echo "<table border=1>\n";

echo "<tr><td>Name</td><td>Position</td></tr>\n";

do {

printf("<tr><td>%s %s</td><td>%s</tr>\n", $myrow["1"], $myrow["2"], $myrow["3"]);

} while ($myrow = mysql_fetch_array($result));

 echo "</table>\n";



Maybe if you look at this 2 image it will give you an idea of what im trying to acheived. heres the sample image of how it looks.: Click Here and the result page would look like this.: Click Here


basically if u click on an item on the checkbox it will show you the result on a table to show comparisson. I hope you can help me here guys.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.