Well, it depends on how you write your code. You can actually have the option of multiple actions for one form.
Look at "Submit" and "Reset"... there's two different actions right there.
You can have multiple buttons on the same form and have each button assigned a different value. The action performed on the form data would be dependant upon the value of the pressed submit button.
Let's see if I can whip up a brief example for you:
PHP Code:
<html>
<head>
<title></title>
</head>
<body>
<form name="exampleForm" action="recievingCode.php" method="post">
<input type="text" name="textField" value="" />
<input type="submit" name="submit" value="Submit" />
<input type="submit" name="submit" value="Delete" />
<input type="submit" name="submit" value="Change" />
<input type="submit" name="submit" value="Hop" />
<input type="submit" name="submit" value="Skip" />
<input type="submit" name="submit" value="Jump" />
<input type="reset" value="Reset" />
</form>
</body>
</html>
Now in this form, we could perform one of 6 actions, Submit, Delete, Change, Hop, Skip, or Jump, upon the data (the lone text field in this form), depending up which "submit" button is pressed.
We can do this because the VALUE of the submit button is checked by the recievingCode.php file and the appropriate action performed.
PHP Code:
<?php
$submit = isset($_POST['submit']) ? $_POST['submit'] : '';
if($submit == 'Submit')
{
// code to perform when "Submit" was pressed
}
if($submit == 'Delete')
{
// code to perform when "Delete" was pressed
}
...
if($submit == 'Jump')
{
// code to perform when "Jump" was pressed
}
?>
Is this want you were looking for?
Bookmarks