<---probem to sovle--->
Selecting multiple data from the Database with
checkbox and print/echo selected item.
This is how it goes, From the check_box.php page,
there are some date being retrieve from the database and bind with the check box,
so the check box is reference with id from the data then i create a repeat region to print more data on the table,
so after checking more than one check box from the data in the table. the order Action takes place in the select_chk.php page_script
i want to what to or how to create an array or loop that will accept this data so that it can be insert into another table
//Create Database
Create database chkboxes
//Create table
Create table tbl1
//Column of the table
Msgid
From
To
Message
CODE
<-----Below are the line of code----->
//check_box.php
<?php
$con = mysql_connect('localhost','root','')or die(mysql_error());
$db = mysql_select_db('chkboxes',$con)or die(mysql_error());
$query = mysql_query("SELECT * FROM tbl1")or die(mysql_error());
?><form Method="post" Action="select_chk.php" >
<?php
while($result = mysql_fetch_assoc($query))
{
$i++;
?>
<tr>
<td width="20%" align="center">
<input name="<?php echo $result['Msgid']?>" type="checkbox" id="<?php echo $result['Msgid']?>" value="<?php echo $result['Msgid']?>">
</label></td>
<td width="20%" align="center"><?php echo $result['tFrom']?></td>
<td width="20%" align="center"><?php echo $result['tTo']?></td>
<td width="20%" align="center"><?php echo $result['Subject']?></td>
<td width="20%" align="center"><?php echo $result['Message']?> </td>
</tr>
<?php
}
?>
<tr>
<td align="center"><input type="submit" name="Submit" value="Submit" /></td>
<td align="center"> </td>
<td align="center"> </td>
<td align="center"> </td>
<td align="center"> </td>
</tr>
</table>
</form>
//select_chk.php
<?php
$con = mysql_connect('localhost','root','duduyemi')or die(mysql_error());
$db = mysql_select_db('chkboxes',$con)or die(mysql_error());
$query = mysql_query("select * from tbl1");
$i=0;
while($r = mysql_fetch_array($query))
{
$msg = $r['Msgid'];
if(isset($_POST[$msg])!=NULL)
{
$i++;
mysql_query("select * from tbl1 Where Msgid=$msg")or die(mysql_error());
}
}
echo "Result".$i['tFrom']
?>
Mod Edit: Please use code tags when posting your code. Code tags are used like so =>

Thanks,
PsychoCoder