I have a lot of files with different forms. All the forms are send to the same file, which, depending on what kind of name the submit button has, will include the right file to be used. Here is an example:
start.php:
<form name="input" action="controller.php" method="post">
<input type="submit" name="dostuff1" value="SEND1" />
<input type="submit" name="dostuff2" value="SEND2" />
</form>
controller.php:
if(isset($_POST['dostuff1'])) {
$action = "dostuff1";
} elseif(isset($_POST['dostuff2'])) {
$action = "dostuff2";
}
include($action.".php");
Now I'm looking for a way to throw out the whole "if else" part. What I want to know is if it's possible to send out a form with a button that has a variable stored in it's name, like this for example:
<input type="submit" name="action["dostuff1"]" value="SEND" />
Note: I'm still a noob (obviously) and the application I'm working on will be used solely for private purposes (security is not a concern here).