php two self submitting forms on one page -
i have webpage form submits carry out php action. want add second form same webpage capable of self submit not having luck finding working solution setup. here webpage looks like.
first, checks see if page has been submitted, , if has, redirects elsewhere.
if($_server['request_method'] == "post") { header("location: viewcustomers.php"); }
next, form itself.
<form id="addcustomer" method="post" action=""> ..stuff.. </form>
then, form action.
if('post' == $_server['request_method']) { ..phpstuff.. }
how adjust form action (or add another) differentiate between 2 different forms?
thanks.
easy!
<?php if(isset($_post['action']) && $_post['action'] == 'form1') { // form 1 } else if(isset($_post['action']) && $_post['action'] == 'form2') { // form 2 } ?> <form action="#" method="post"> <input type="hidden" name="action" value="form1" /> </form> <form action="#" method="post"> <input type="hidden" name="action" value="form2" /> </form>
Comments
Post a Comment