I have an HTML form that submits to a PHP script through two different links that fire JavaScript code. What I need is to be able to submit the form differently through the two JavaScript links so that I can check for that difference on the PHP side. I realize I could do this with submit buttons, but I'm trying to avoid that. I was hoping something like this would work:
foo.html
<form name="fooform" action="fooscript.php" method="POST">
<input type="text" name="footext">
</form>
<a onclick='document.fooform.submit();' href='#'>Do something</a>
<a onclick='document.fooform.submit();' href='#'>Do something else</a>
<!--
<a onclick='document.fooform.submit(0);' href='#'>Do something</a>
<a onclick='document.fooform.submit(1);' href='#'>Do something else</a>
-->
fooscript.php
<?php
if(submit(0)){
//Do something
}
if(submit(1)){
//Do something else
}
?>