Reputation:
If I submit forms without input(type="submit") and I use a href with javascript, like this:
<a href="javascript:document.form-name.submit();" rel="nofollow">Button</a>
Is a way to check with php what form is submitted? (with input, I use if (isset($_POST['input-name']))
)
Upvotes: 0
Views: 182
Reputation: 82088
Natively? Not through JS. You'll need to modify the values which are sent. There are a couple of ways to do that:
<form action="/processor.php?input-name=INPUT!">
Then get the value from $_GET in PHP (warning, this will not work if the request is a get request). <input type="hidden" name="input-name" value="INPUT!" />
The value will now be part of either $_GET or $_POST, depending on the action of the form.Upvotes: 0
Reputation: 6896
Just use this temporarily to understand what PHP is receiving from the POST array.
var_dump($_POST);
Upvotes: 0
Reputation: 28936
Include a hidden field in your form that contains the form identification data you desire.
Upvotes: 2