blufish Posted August 8, 2008 Share Posted August 8, 2008 Okay so I have a form with a "submit" button and a "preview" button. How do I make it so that I can check which button was pressed? Link to comment https://forums.phpfreaks.com/topic/118752-solved-two-buttons-in-a-form/ Share on other sites More sharing options...
MasterACE14 Posted August 8, 2008 Share Posted August 8, 2008 if you want to check which one was pressed instantly, you need to use either Javascript or AJAX. otherwise, you can find out with PHP... <?php if(isset($_POST['button1'])) { echo "Button 1 was Pressed!"; } elseif(isset($_POST['button2'])) { echo "Button 2 was Pressed!"; } ?> Link to comment https://forums.phpfreaks.com/topic/118752-solved-two-buttons-in-a-form/#findComment-611406 Share on other sites More sharing options...
blufish Posted August 8, 2008 Author Share Posted August 8, 2008 thanks! Link to comment https://forums.phpfreaks.com/topic/118752-solved-two-buttons-in-a-form/#findComment-611407 Share on other sites More sharing options...
MasterACE14 Posted August 8, 2008 Share Posted August 8, 2008 no worries Link to comment https://forums.phpfreaks.com/topic/118752-solved-two-buttons-in-a-form/#findComment-611408 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.