Jump to content

[SOLVED] help with simplifying


MDanz

Recommended Posts

i got like 874 lines of code..

 

 

is there a way i can simplify these, since there are 4 duplicates with different changes inside if and else statements..

 

e.g.

if{

  if{

    code 1

    }

  else {

    code 2

    }

}

else{

  if{

    code 3

    }

    else {

    code 4

    }

 

}

 

 

 

do i use class or include?.. it will be way easier since i'm lost in brackets..

Link to comment
https://forums.phpfreaks.com/topic/175114-solved-help-with-simplifying/
Share on other sites

this is what i attempted but not working

 

<?php
$radiobutton = $_GET['radiobutton'];
if($radiobutton == 'on')
{
include("searchtopic.php");
}
else
{
include("searchnormal.php");
}

?>

 

i want if radiobutton is checked on the submit form then use searchtopic code otherwise use searchnormal code..

 

 

this was just an attempt i saved the code in different files.. if another way is easier i'm welcome to do that..

 

 

 

What does your form look like?

 

 <form action="test.php" method="get">
<center>
   <input name="search" type="text" value='' size="25" />
   <input type="submit" name="submit" value="search">

   <input name="radiobutton" type="radio" value="radiobutton">
</center>

</form>

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.