Lokolo Posted May 9, 2007 Share Posted May 9, 2007 ok basically i have 2 forms, one shows up at the start, that gets submitted and the page refreshes wth the 2nd one. however, i cannot figure how to submit the 2nd one as the forms are both submit forms. (basically once i submit the first one, it then goes to the elses of both. i can get the 2nd form to display if i change the 2nd !isset($_POST['submit']) to something else but then i can't submit that one) <? if (!isset($_POST['submit'])) { ?> <h2> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" onsubmit="return checkSubmit(this);"> Number of Rooms: <input type="text" size="3" multiple style="height: 20px" maxlength="2" name="numrooms"> <input type="submit" name="submit" value="Upgrade"> </form> </h2> <? } else { upgradehotel($_POST['numrooms']); if (!isset($_POST['submit'])) { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" onsubmit="return checkSubmit(this);"> <input type="submit" name="confirm" value="Yes"> <input type="submit" name="confirm" value="No"> </form></h2> <? } ELSE { echo "work damnit work"; } ?> heh thanks! Quote Link to comment https://forums.phpfreaks.com/topic/50663-solved-2x-isset_postsubmit-how-to-get-it-to-work/ Share on other sites More sharing options...
per1os Posted May 9, 2007 Share Posted May 9, 2007 <? if (!isset($_POST['submit'])) { ?> <h2> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" onsubmit="return checkSubmit(this);"> Number of Rooms: <input type="text" size="3" multiple style="height: 20px" maxlength="2" name="numrooms"> <input type="submit" name="submit" value="Upgrade"> </form> </h2> <? } else { upgradehotel($_POST['numrooms']); if (!isset($_POST['confirm'])) { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" onsubmit="return checkSubmit(this);"> <input type="submit" name="confirm" value="Yes"> <input type="submit" name="confirm" value="No"> </form></h2> <? } ELSE { echo "work damnit work"; } ?> Your logic is flawed. For the second portion you need to check $_POST['confirm'] as that is what you gave the name of the submit field. Quote Link to comment https://forums.phpfreaks.com/topic/50663-solved-2x-isset_postsubmit-how-to-get-it-to-work/#findComment-249025 Share on other sites More sharing options...
Lokolo Posted May 9, 2007 Author Share Posted May 9, 2007 indeed - i tried that but it then just goes back to the first form. obviously that value of submit is wiped as soon as i touch the 2nd form. (if you understand me) not sure how i can get around this though Quote Link to comment https://forums.phpfreaks.com/topic/50663-solved-2x-isset_postsubmit-how-to-get-it-to-work/#findComment-249033 Share on other sites More sharing options...
per1os Posted May 9, 2007 Share Posted May 9, 2007 Put the confirm as the first if, since it is the secondary portion. Put the submit as the elseif. Order of operations. Quote Link to comment https://forums.phpfreaks.com/topic/50663-solved-2x-isset_postsubmit-how-to-get-it-to-work/#findComment-249038 Share on other sites More sharing options...
taith Posted May 9, 2007 Share Posted May 9, 2007 or just put a hidden field with the name of submit... Quote Link to comment https://forums.phpfreaks.com/topic/50663-solved-2x-isset_postsubmit-how-to-get-it-to-work/#findComment-249040 Share on other sites More sharing options...
Lokolo Posted May 9, 2007 Author Share Posted May 9, 2007 hidden thing worked. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/50663-solved-2x-isset_postsubmit-how-to-get-it-to-work/#findComment-249054 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.