i have html form
i am using <a href="#" onclick="document.aa.submit()"> instead of submit button
my code will explain my problem better..
<html>
<form name="aa" action="aa.php" method="post">
<input type="checkbox" name="posts[]" value="1">
<input type="checkbox" name="posts[]" value="2">
<a href="#" onclick="document.aa.submit()">Delete</a>
<a href="#" onclick="document.aa.submit()">Move</a>
</form>
</html>
aa.php
<?php
print_r($_POST);
?>
results
Array ( [posts] => Array ( [0] => 1 [1] => 2 ) )
Now the question is:
How to know user clicked on delete or move?
Note:
i know if i used <input submit> it will fixes the problem
but i can’t use submit button for some reason
Note 2
the question is how to detect it by php.
Example:
Array ( [posts] => Array ( [0] => 1 [1] => 2 ['submit'=>'delete']) )
if('delete'){
mysql_query("delete from...")
}
else{
mysql_query("update/move ....");
}
You need to make some tweaks to the form so the Post value knows which option you are submitting
in js with jquery
in php