4
Contributors
18
Replies
20
Views
4 Years
Discussion Span
Last Post by andyy121
0
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
0

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";
}
0

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

0
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>';

}
}
}

?>
-1

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

0

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

0

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

0

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

0

@andyy121

Did you read Squidge question?

mysql_real_escape_string will require a database connection.

Do you have a db connection?

0

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

0

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

0

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

0

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

1

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

Votes + Comments
Damn right, tell it how it is
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.