Jump to content

Getting Values from a Textbox that is in a While Loop?


ZeTutorials101

Recommended Posts

$sql = mysql_query("SELECT * FROM hacker_log");
   echo '<form action="" method="POST">';
while ($row = mysql_fetch_assoc($sql)){

   $ip = $row['ip'];
   $time = $row['time'];
   $id = $row['id'];
   echo 'IP: $ip Time: $time <input type="hidden" name="id" value="'.$id.'"><input type="submit" name="remove" value="Remove From Log">';

} 
   echo '</form>';
if (isset($_POST['remove'])){
echo $_POST['id'];
}


That is my code, but when I try it.. it doesn't work.

It looks like the OP just wants the single ID for the item to remove. I would personally use anchor tags instead of the remove buttons and the HTML form.

I agree, but the OP didn't make any effort to use anything we said so far, so...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.