View Full Version : Tick Checkbox & Display Selected Records

01-24-2008, 02:47 PM
I have queried a MySQL database & displayed the results on a page. These results have checkboxes next to each record just like Yahoo Mail. The code is below & is working fine.

Now, the next thing I want to do is to tick a few checkboxes and display only the ticked records on a new page for printing purposes. How do I do this?


<form name="form1" method="POST" action="">
//connect to the database here

$result = mysql_query("SELECT username FROM users WHERE user_posts = 0
AND username != 'Anonymous' AND user_regdate < $four_months");

while ($row = mysql_fetch_array($result))
echo "<input type='checkbox' name='boxes[]' value='{$row
['user_id']}'>" . "&nbsp;" . $row['username'];
echo "<br>";

01-24-2008, 03:28 PM
<input type='checkbox' name='boxes[]' value='{$row['user_id']}'>
user_id is not selected in the query.

<input type="checkbox" checked> will do the trick!