php - checkbox submit on href (html) -
i submit form without submit button when click on href. here code :
page 1 :
<form name="myform" method="post" action="page2.php"> <input type="checkbox" name="condition" value="1"> </form> <a href="page2.php?item=n" onclick="document.forms['myform'].submit();"> link </a> page 2 :
$_session['condition'] = isset($_post['condition'])? 1 : 0; the problem $_post['condition'] never set, when box checked.. seems form not submited page1 page2. have clue why happen ?
edit :
maybe wasn't clear trying achieve edited code : using href because have list of ref on user can click wanted add option checkbox. want send option arguments of ref when user clicks on ref.
how this?
<a href="page2.php?item=n" onclick="document.forms['myform'].attributes.action.value = this.attributes.href.value; document.forms['myform'].submit(); return false;"> link </a>
Comments
Post a Comment