itdmacar Posted September 9, 2007 Share Posted September 9, 2007 Hi, How do you process if you have forms in your script ? I have form 1 and form 2 in my scripts and their method are both 'POST', my logic is to go back to the same script whenever I click the submit button from my form 1, my problem is whenever I click the select botton and goes back to the same script it does not recognise the other buttons from Form 2. How do I process 2 forms ? Can someone has the sample scripts, please . . . Quote Link to comment https://forums.phpfreaks.com/topic/68623-solved-forms-in-php/ Share on other sites More sharing options...
GingerRobot Posted September 9, 2007 Share Posted September 9, 2007 Something along the lines of: <?php if(isset($_POST['submitbutton1'])){ //process 1st form } if(isset($_POST['submitbutton2'])){ //process 2nd form } //any html headers/css etc ?> <form action=<?php echo $_SERVER['phpself'];?> method="POST"> <?php if(!isset($_POST['submitbutton2'])){ if(!isset($_POST['submitbutton1'])){//neither form submitted //show first form echo '<input type="submit" name="submitbutton1">'; }else{//first form has been submitted //show second form echo '<input type="submit" name="submitbutton2">'; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/68623-solved-forms-in-php/#findComment-344911 Share on other sites More sharing options...
itdmacar Posted September 9, 2007 Author Share Posted September 9, 2007 Thanks for the quick reply . . . I gonna try it first . . . Quote Link to comment https://forums.phpfreaks.com/topic/68623-solved-forms-in-php/#findComment-344914 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.