I want to submit a form through an 'edit(param1,param2)' function which in turn is being called in either of the two ways..
echo '<input type="button" value="DELETE" onclick="edit(\''.$key.'\',\''.$b.'\')"/>';
or
echo '<a href="list_cadmin.php" onclick="edit(\''.$key.'\',\''.$b.'\')"><span class="bluetext">DEACTIVATE</span>';
the function edit() is something like this:
function edit(a,b) {
var answer = confirm("Do You Really want to Deactivate ?")
if (answer){
alert(a)
document.getElementById('cid').value= a;
document.getElementById('key').value= b;
document.getElementById('fname').method='get';
document.getElementById('fname').action='samepage.php';
document.getElementById('fname').submit();
}
}
where $key and $b are number and string values respectively.
so, according to the above both should go to 'samepage.php?cid=BLAHBLAH&key=1234' on onClick. But only the input=button is working. Hyperlink is reloading without the GET parameters. How do i get the hyperlink to work?