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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.