wim taerwe wrote:
Hello,
I am looking for an easy way to have a delete button per subitem in 1
form.
For example : a book can have many authors and when I edit the book
details I want to have a list of the authors each with a separate
delete-submitbutton next to it. Now I have the problem that I cannot
know which exact author I want to delete when I click the delete button
next to it.
I could name every delete button differently like
"delete_author1","delete_author2",... but what is the easiest way to
process this after the submit.
Thanks in advance for your reactions,
Wim Taerwe
If you want you can have multiple submit buttons, each indicating
a different author to delete.
eg: (copied from a form that has multiple submit buttons to
indicate disposition of the displayed provisional web page,
generated by php)
--------------------------------------
<form method="post" action="approve_or_not.php" >
// put page id in a hidden element
<input type="hidden" name="kennel_id "
value="<?php echo $_POST[kennel_id] ?>" />
<button type="submit" name="disposition" value="approve">
Approve and make this page active. </button
<button type="submit" name="disposition" value="disapprove">
Disapprove and return to data entry page. </button
<button type="submit" name="disposition" value="quit">
Save data and just quit. </button>
</form>
---------------------------------------------------------
This will generate 3 buttons with the same name but different
values and captions.
In the receiving page I just look at the value of
$_POST[disposition] to take the appropriate action.
bill