I have a form on which I have two buttons 'add' and 'delete'. I have to take seperate action for both of the button. How can I do that. Please give an example.
maybe it will help make to submit button like these: <FORM method="post" action="filter.php"> <INPUT name="submitAsAdd" type="submit" value="Add"> <INPUT name="submitAsDelete" type="submit" value="delete"> </FORM> PHP: and then make a filter file to check what the angine has to do and redirect it to the processor file. //filter.php: <?PHP if ($_POST[submitAsAdd]) { header ("location:add.php"); } if ($_POST[submitAsDelete]) { header ("location:delete.php"); } ?> PHP: i hope it helps
No matter which quotes you use. Read the "Do's and don'ts section here; www.php.net/language.types.array And the isset() should be used as followed: if (isset($_POST['submitAsAdd'])) { PHP: www.php.net/isset
hey junandya, thanks for the idea.. I've often dealt with that problem with javascript on the form page to set a new action on the form, but I think I will use this way in the future, it seems much easier Thanks!