Nested form problem in while loop

hi all

inside while loop i have one < input checkbox > for multiple delete.

if checkbox is seleted then it gets deleted.

then inside while loop i also have a nested form to show product status like “show/ hide”

the problem is

the multiple delete button only works if i remove the nested form.

but i want to keep both features forms.

<?php
if(isset($_REQUEST['delete_all']))
{
    echo "delete all btn pressed";
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form name="multi_del" method="post" action="">
<?php
// here is a while loop
echo '<input type="checkbox" name="delprod[]" />check to delete<br /><br />';

echo "<form name='status_update'" . " action='" . $qrystring . "' method='post'>";
echo '<td valign="top">';
echo '<input type="submit" value="hide/show" name="hs_bt" />';
echo '<input type="hidden" name="status" value="'.$row['product_id'].'" />';
echo '<input type="hidden" name="url" value="'. $qrystring .'" />';
echo '</td>';
echo '</form>';
// while loop ends
?>
<br />
<input type="submit" value="delete all" name="delete_all" />
</form>
</body>
</html>

just avoid it. at least its invalid, but mostly you will run into issues with browsers.

you can’t have them in HTML so there is nothing you can do to ever get it to work while the form is nested as nothing will work properly with that invalid HTML.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.