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.

<?php
  $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'>
<tr>
<th>Name</th>
<th>classification</th>
</tr>";

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>";

mysql_close($con);


?>

<?php



?>

<html>
<head>

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

<input type="submit"  name="Submit"      value="Submit"> 
</p> 
</form> 

<body>

</body>
</html>

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

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

<?php
error_reporting(E_ALL);

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

$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";

} 

?>
Member Avatar for iamthwee

What? I didn't get your example...

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.