Jump to content

button help


MDanz

Recommended Posts

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

<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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.