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'. Link to comment https://forums.phpfreaks.com/topic/101643-solved-buttons/ 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 } ?> Link to comment https://forums.phpfreaks.com/topic/101643-solved-buttons/#findComment-520051 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 Link to comment https://forums.phpfreaks.com/topic/101643-solved-buttons/#findComment-520053 Share on other sites More sharing options...
AP81 Posted April 18, 2008 Share Posted April 18, 2008 Turn a and b into functions. Link to comment https://forums.phpfreaks.com/topic/101643-solved-buttons/#findComment-520054 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.