<form action="search.php" method="post" class="search" id="search">
<input name="search" id="search" type="text" value=""><br>
</form>
...
echo ".urlencode($_POST['search']).";
here is my basic search box. I want: 1. open the page first, the ".urlencode($_POST['search'])."
is empty. 2. when the client type some word and make a search, the ".urlencode($_POST['search'])."
will always add a additional keyword after client type word.
for example, when the client type: apple, the ".urlencode($_POST['search'])."
part show: apple20%juice
, when the client type: orange, the ".urlencode($_POST['search'])." part show: orange20%juice
, it always add a additional keyword 20%juice
behind the key word.
How to reach this one? Thanks.
like this:
check if the search is set first if so go ahead and grab the string and add juice to it
if(isset($_POST['search']))
{
$searchterm = $_POST['search']." juice";
//follw by other stmts...
}
Couldn't you simply use;
print urlencode($_POST['search'].' juice');