0

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'])))

1
  • 6
    Fixed your references to Java. Java is to JavaScript like Car is to Carpet. Commented Jun 21, 2011 at 17:30

3 Answers 3

2

Include a hidden field in your form that contains the form identification data you desire.

Sign up to request clarification or add additional context in comments.

Comments

0

Just use this temporarily to understand what PHP is receiving from the POST array.

var_dump($_POST);

Comments

0

Natively? Not through JS. You'll need to modify the values which are sent. There are a couple of ways to do that:

  • Change the action: <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).
  • Add a hidden input: <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.

Comments