Hello My name is Adeyemi Okeowo a young programmer from nigeria, i 'm very delighted to be a member of this forum, Below are the lines of my code which i've been having errors. This is what i want this code to do is; Select multiple check from a database(mysql) through a checkboxes of a form.
There are two pages of script,the 1st one (check_box.php) will get data out from database and be echo in the table with 2rows and 4columns the second row of the 2rows will be programmed repeat region while the checkbox will be reference with the id of the row which i have done, but i'm having problem with the other page script (select_chk.php) on how to accept the data from the post so that it can be insert into another table in the same database...
Below are the script...
CODE
//Create Database
Create database chkboxes
//Create table
Create table tbl1
//Column of the table
Msgid
From
To
Message
<-----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());
}
}http://www.dreamincode.net/forums/showforum88.htm
echo "Result".$i['tFrom']
?>
**Added code tags***
-jjsaw5