anser316 Posted April 18, 2008 Share Posted April 18, 2008 if(isset($_POST['button2'])){ if(isset($_POST['button1'])){ a(some code) } b(some code) echo "<input type =submit name='button2' value= button 2>";} Does this mean that both have to be set or either to show a? What I am trying to do is show 'a' when button1 is set, whether or not button2 is set or not. And when button 2 is set, show 'a' and 'b'. Quote Link to comment Share on other sites More sharing options...
unidox Posted April 18, 2008 Share Posted April 18, 2008 Here: <?php if (isset($_POST['button1'])) { a; } elseif (isset($_POST['button2'])) { a b } ?> Quote Link to comment Share on other sites More sharing options...
anser316 Posted April 18, 2008 Author Share Posted April 18, 2008 The thing is a and b are big codes, so i was wondering if there was any way in doing it without repeating any code Quote Link to comment Share on other sites More sharing options...
AP81 Posted April 18, 2008 Share Posted April 18, 2008 Turn a and b into functions. Quote Link to comment 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.