when i click in the search button it must display whatever i type in

if (isset($_POST['keyword'])){
$keywords = mysql_real_escape_string (htmlspecialchars(trim($_POST['keywords'])));
echo '$keywords';
}


 what i have to change in this code this doesn't display nothing when i click in search plz help

andyy121:
mysql_real_escape_string will require a database connection.

I would suggest you approach from a different angle

if (isset($_POST['keyword'])){
    $keywords = strip_tags(trim($_POST['keywords']));
    echo $keywords; // remove the ''
}
else {
    echo "Keywords is empty";
}

hey i have added this but it doen't display what i write in search field

if (isset ($_POST['keywords'])){
$keywords =mysql_real_escape_string(htmlentities(trim($_POST['keywords'])));

$errors = array ();

if (empty ($keywords)){
$errors[] = ('Please enter a serch terms');
}else if (strlen($keywords)<3){
$errors[] = ('Your search terms must be three or more characters');
}else if (1==2){
$errors []= ('Your seach for '.$keywords.' returned no results');
}
if(empty($errors)) {
//search

}else {


foreach ($errors as $error){
echo '$error','</br>';

}
}
}

?>

hey can you give some ideas what i have to change in the code plzz write me as soon as you can,

comment line 2, everything will run proeplry then
//$keywords =mysql_real_escape_string(htmlentities(trim($_POST['keywords'])));

it doesnt work :( when i write in search field flash or andi or something else the page is still blang it must display what i write in the search fild

is somebody here tel me what??

i just wont to write somethink in search field and than click in search buttons so it display what i have wrote in it

Member Avatar

LastMitch

@andyy121

Did you read Squidge question?

mysql_real_escape_string will require a database connection.

Do you have a db connection?

yes i have,i have create a db,
article_id,titel ,description,url,keywords.

line 2 comment it
$keywords =mysql_real_escape_string(htmlentities(trim($_POST['keywords'])));

line 3 add new line
$keywords =$_POST['keywords'];

Line 20 change as follow
echo "$error,</br>";

hey i have added this but it doen't display what i write in search field

if (isset($_POST['keywords'])){
    $keywords = strip_tags(trim($_POST['keywords']));
    echo $keywords; // remove the ''
}

This works for me with no problem

@Squidge it wasnt verey helpful your reply but i have fix it by the way thnx for the help

@andyy121:
Quite frankly with the attitude you come on to the forum with i have given up caring.

People on here have help you and pointed you in viable directions, and yet you seem to think everyone on here owes you something.

If it was possible i would have you blocked from my profile, and considering how rude you were on the last thread, good ridence to you.

@Mods,

No offence intended to anyone on here, but this guys attitude sucks.

commented: Damn right, tell it how it is +14

sory if i have offended you are someone else, with the help of all i have learn a lot in php sorry for everything adn thank you all