MDanz Posted October 14, 2009 Share Posted October 14, 2009 i originally had this but realised it much easier to have a button. <?php $checkbox = $_GET['checkbox']; if($checkbox == 'on') { include("searchtopic.php"); } else { include("searchnormal.php"); } ?> how do i make a javascript button that anytime it is clicked it refreshes the page and includes either searchtopic.php or searchnormal.php? Link to comment https://forums.phpfreaks.com/topic/177680-button-help/ Share on other sites More sharing options...
KevinM1 Posted October 14, 2009 Share Posted October 14, 2009 <html> <!-- the head and all that jazz --> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="submit" name="search1" value="Search Option 1" /> </form> </html> $on = $_POST['search1']; if($on == "on") { include("searchtopic.php"); } else { include("searchnormal.php"); } No JavaScript required. Link to comment https://forums.phpfreaks.com/topic/177680-button-help/#findComment-936899 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.