guzmanistan
Weaksauce
- Joined
- Jun 3, 2005
- Messages
- 92
I don't really get arrays.
I've got this page that reads from one table in my database. I want to be able to click a checkbox and then send the data in a row to another database and delete that row. I don't really understand arrays and I think that's the key for this thing.
The page is http://yoursouthbridge.com/pendingevents.
Heres the necessary code:
Any help appreciated.
Thanks again you guys are always helpful.
I've got this page that reads from one table in my database. I want to be able to click a checkbox and then send the data in a row to another database and delete that row. I don't really understand arrays and I think that's the key for this thing.
The page is http://yoursouthbridge.com/pendingevents.
Heres the necessary code:
Code:
<form action='<?php echo($_SERVER['PHP_SELF']) ?>' method='post'>
<?php
$result = mysql_query("SELECT * FROM pending",$db);
if ($result) {
$row_num = 1;
while ($row = mysql_fetch_array($result)) {
$numrows = mysql_num_rows($result);
echo '<tr><td>'.$row['date'].'</td>';
echo '<td>'.$row['event'].'</td>';
echo '<td>'.$row['location'].'</td>';
echo '<td>'.$row['time'].'</td>';
echo '<td>'.$row['details'].'</td>';
echo '<td>'.$row['name'].'</td>';
echo '<td>'.$row['site'].'</td>';
echo '<td>'.$row['email'].'</td>';
echo '<td>'.$row['phone'].'</td>';
echo '<td><input type="checkbox" name="cb'.$row_num.'"></td></tr>';
$row_num++;
}
}
?>
<tr><td colspan="10"><?php echo $row_num ?><input type='Submit' name='submit' />
</form>
</table>
<?php
if (isset($_POST['submit'])) {
$row_count=1;
while ($row_count < $row_num) {
$cbnum= 'cb'.$row_count;
echo $cbnum;
if (isset($_POST['$cbnum'])) {
mysql_query("INSERT INTO eventt VALUE $row", $db);
}
$row_count++;
}
}
?>
Any help appreciated.
Thanks again you guys are always helpful.