Hi,
We can code this way to print something if Exit button is clicked.
<form action="process.php" method="POST">
<input type="hidden" name="hiddenName" value="Jolly" />
<input type="submit" name="submit" value="Exit" />
</form>
if($_POST["submit"] == "Exit") {
echo $_POST["hiddenName"];
}
What about if we use this way. How do i check if Exit button was clicked or not?
<form name="formExit" action="process.php" method="POST">
<input type="hidden" name="hiddenName" value="Jolly" />
<a href="#" onclick="document.formExit.submit()" title="Exit">EXIT</a>
</form>
if( ???????????? == "Exit") {
echo $_POST["hiddenName"];
}
Thanks in advance
<script type="text/javascript">
function submitForm(val)
{
document.getElementById('submitted').value = val;
document.getElementById('submitted').form.submit();
}
</script>
<form action="process.php" method="post">
<input type="hidden" name="submitted" id="submitted" value="" />
<a href="#" onclick="submitForm('EXIT');">EXIT</a>
</form>
Last edited by ShawnCplus; Oct 12th, 2009 at 1:34 pm.
Reputation Points: 520
Solved Threads: 268
Code Monkey
Offline 1,564 posts
since Apr 2005