Can you tell what do i do wrong?

this is the statement

    if (isset($_POST['search_all']))
        if (empty($_REQUEST['src_all'])) 
            echo "<p>You forgot to enter a search term</p>"; 
        elseif (!empty($_REQUEST['src_all']))
            $Filter = " M.message LIKE '%" . $_REQUEST['src_all'] .  "%'";
            $Order = " ORDER BY M.created DESC";

this is html

 <form name="search" method="post" action="<?=$PHP_SELF?>">

<input id="src_all" name="src_all" onblur="if (this.value == '') { this.value='Search '; jQuery(this).addClass('blank'); };" onfocus="if (this.value == 'Search ') { this.value=''; jQuery(this).removeClass('blank'); };" type="text" value="Search" />
<input id="search_all" name="search_all" type="submit" value="" />

3 Years
Discussion Span
Last Post by fobos

I think that one issue is that there is a value in src_all so its not empty


@SimonIoa, the onfocus event will remove the "Search".
With that being said, SimonIoa still has a point. You should have that in your input if you are asking to verify if its blank or not. Instead of calling a $_REQUEST, use $_POST instead. $_REQUEST is the default if you didnt have anything else, but this is no perfect world. Also if your checking to see if its blank why run another elseif. I mean that you are already checking to see if its blank so there is no reason to see if there is something there, unless you are unescaping the string.

I would try to give it a test..

if(isset($_POST["search_all"])) {
    if($_POST["search_all"]==" " || $_POST["search_all"] == "Search") {
        return false;
    } else {
        return true;

I hope this helps.

This question has already been answered. 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.