Jump to content

Removing Search String


smonkcaptain

Recommended Posts

Hey all,

 

I'm using the form 'method="get" action="results.php"' on my search form...

Say someone uses my 'Photo search' to search my database for aircraft, and leaves all fields blank. In this case, the only field of the search is 'aircraft'.

 

 

This will take the user to 'results.php?aircraft='.

 

Is there anyway to remove the sting if there is no search value? So it would just read 'results.php'?

 

This is the code i have so far:

 

 

<?php

if(isset($_GET['aircraft'])){
$aircraft = $_GET['aircraft'];
}

if($aircraft==""){
$aircraft = mysql_query("IGNORE aircraft");
}

?>

 

Thanks in advanced!

Link to comment
https://forums.phpfreaks.com/topic/232469-removing-search-string/
Share on other sites

Hey all,

 

I'm using the form 'method="get" action="results.php"' on my search form...

Say someone uses my 'Photo search' to search my database for aircraft, and leaves all fields blank. In this case, the only field of the search is 'aircraft'.

 

 

This will take the user to 'results.php?aircraft='.

 

Is there anyway to remove the sting if there is no search value? So it would just read 'results.php'?

 

This is the code i have so far:

 

 

<?php

if(isset($_GET['aircraft'])){
$aircraft = $_GET['aircraft'];
}

if($aircraft==""){
$aircraft = mysql_query("IGNORE aircraft");
}

?>

 

Thanks in advanced!

 

Now Resolved -

 

Used POST instead of GET.

 

Thanks Anyway

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.