PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
tiresome
Forum Newbie
Posts: 16 Joined: Sun Apr 18, 2004 9:45 am
Post
by tiresome » Mon Apr 19, 2004 9:13 am
Code: Select all
<?php
mysql_select_db('test');
$entryid[] = $HTTP_POST_VARS['entry_id[]'];
while (list($key, $value) = each($entryid)) {
if ( !empty( $value)) {
print "<li>Deleting entry #$value\n";
$query = "delete from guestBook where entry_id = $value";
$result = mysql_query($query);
?>
the php document below submits the data to the php document but there is an error in line 3 of the above php cod($entry[]...)
Code: Select all
<?php
echo '</td>';
echo '<td>';
print '<input type="checkbox" name="entry_id[]" value=';
print $row['entry_id'];
print '> Yes, delete entry #';
print $row['entry_id'];[/url]
?>
Since entry id is an array shouldn't i post it as an array item or should i just post it as a variable without the square brackets at the end?[/php_man]
tiresome
Forum Newbie
Posts: 16 Joined: Sun Apr 18, 2004 9:45 am
Post
by tiresome » Mon Apr 19, 2004 9:14 am
Sorry I meant to say the php doc below submits the data to the php document above ie. they are both separate files.
I am sure you guys figured that out but thought I'd clarify it anyway
magicrobotmonkey
Forum Regular
Posts: 888 Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA
Post
by magicrobotmonkey » Mon Apr 19, 2004 9:21 am
Whats the error? and trying doing a print_r($HTTP_POST_VARS['entry_id[]']) to see just what that guys full of!
note: $HTTP_POST_VARS is old! Use $_POST
tiresome
Forum Newbie
Posts: 16 Joined: Sun Apr 18, 2004 9:45 am
Post
by tiresome » Mon Apr 19, 2004 9:34 am
Oh, it's working fine now. I just had to removie all the square brackets from the line below
$entryid[] = $HTTP_POST_VARS['entry_id[]'];
Strange! It works though. I thought entryid was an array. Anyway, I probably have no idea what I am talking about hehe