MasterACE14 Posted December 21, 2008 Share Posted December 21, 2008 This should be really straight forward and working, but it's not, I'm sure it's something really simple I have overlooked. Basically, There is 2 forms on the same page, and they both submit back to the same page they are on. Then 1 of 2 functions is chosen to run depending on what form was submitted. It keeps running standard_supporterstatus(); no matter which of the 2 forms I submit. here's the script(cut down to necessary code only): <?php if($userrow['SSused'] < 3) { if(isset($_POST['act']) == "ss") { include "top.php"; if($userrow['SScount'] > 0) { standard_supporterstatus($userrow['ID']); echo "You have successfully activated a Standard Supporter Status."; } else { echo "You do not have any Standard Supporter Status's in your Count. You can purchase a supporter status <a href=\"supporterstatus.php\">here</a>."; } exit; } elseif(isset($_POST['act']) == "uss") { include "top.php"; if($userrow['USScount'] > 0) { ultimate_supporterstatus($userrow['ID']); echo "You have successfully activated a Ultimate Supporter Status."; } else { echo "You do not have any Ultimate Supporter Status's in your Count. You can purchase a supporter status <a href=\"supporterstatus.php\">here</a>."; } exit; } } else { include "top.php"; echo "You have used all 3 of your Supporter Status bonus's for the week!"; exit; } ?> <tr> <td> <?php if($userrow['SScount'] > 0) { echo "<form action=\"ss.php\" method=\"post\">"; echo "<input type=\"hidden\" name=\"act\" value=\"ss\" />"; echo "<input type=\"submit\" value=\"Activate 1 Standard Supporter Status!\" />"; echo "</form>"; } else { echo "You do not have any Standard Supporter Status's Ready to Activate!"; } ?> </td> </tr> <tr> <td> <?php if($userrow['USScount'] > 0) { echo "<form action=\"ss.php\" method=\"post\">"; echo "<input type=\"hidden\" name=\"act\" value=\"uss\" />"; echo "<input type=\"submit\" value=\"Activate 1 Ultimate Supporter Status!\" />"; echo "</form>"; } else { echo "You do not have any Ultimate Supporter Status's Ready to Activate!"; } ?> </td> </tr> Any help is appreciated. Regards ACE Link to comment https://forums.phpfreaks.com/topic/137887-solved-2-forms-only-1-seems-to-be-working/ Share on other sites More sharing options...
redarrow Posted December 21, 2008 Share Posted December 21, 2008 Name the submit buttons then try. <?php if(isset($_POST['submit1'])){ // do somethink with form 1 }elseif(isset($_POST['submit2'])){ // do somethink with form 2 } ?> Link to comment https://forums.phpfreaks.com/topic/137887-solved-2-forms-only-1-seems-to-be-working/#findComment-720618 Share on other sites More sharing options...
MasterACE14 Posted December 21, 2008 Author Share Posted December 21, 2008 they are? echo "<input type=\"hidden\" name=\"act\" value=\"ss\" />"; echo "<input type=\"hidden\" name=\"act\" value=\"uss\" />"; Link to comment https://forums.phpfreaks.com/topic/137887-solved-2-forms-only-1-seems-to-be-working/#findComment-720619 Share on other sites More sharing options...
omarh2005 Posted December 21, 2008 Share Posted December 21, 2008 maybe ought to change name of the hidden field in the two form echo "<input type=\"hidden\" name=\"act\" value=\"uss\" />"; to another name like echo "<input type=\"hidden\" name=\"act1\" value=\"uss\" />"; Link to comment https://forums.phpfreaks.com/topic/137887-solved-2-forms-only-1-seems-to-be-working/#findComment-720621 Share on other sites More sharing options...
redarrow Posted December 21, 2008 Share Posted December 21, 2008 If there both called act then there need to be a array[] or do below. if you use my example it so easy mate. Link to comment https://forums.phpfreaks.com/topic/137887-solved-2-forms-only-1-seems-to-be-working/#findComment-720623 Share on other sites More sharing options...
MasterACE14 Posted December 21, 2008 Author Share Posted December 21, 2008 if you use my example it so easy mate. Yep I used your example and it worked perfectly, thanks for the information, I shall use submit buttons like that more often. Cheers. maybe ought to change name of the hidden field in the two form echo "<input type=\"hidden\" name=\"act\" value=\"uss\" />"; to another name like echo "<input type=\"hidden\" name=\"act1\" value=\"uss\" />"; Thanks for the suggestion, But I like redarrow's idea of using the submit button for the PHP checks. Thanks for your advice none the less Link to comment https://forums.phpfreaks.com/topic/137887-solved-2-forms-only-1-seems-to-be-working/#findComment-720632 Share on other sites More sharing options...
redarrow Posted December 21, 2008 Share Posted December 21, 2008 masterace14 love your websites mate, Well coded and well formatted i smell money lol. have a grate xmas. Link to comment https://forums.phpfreaks.com/topic/137887-solved-2-forms-only-1-seems-to-be-working/#findComment-720635 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.