Gayner Posted November 30, 2009 Share Posted November 30, 2009 if (isset($_POST['search']) AND $_POST['search']) $search_string = strtolower( str_replace( "*" , "%", $_POST['search'] ) ); $search_string = preg_replace( "/[<>\!\@£\$\^&\+\=\=\[\]\{\}\(\)\"';\.,\/]/", "", $search_string ); echo $search_string; But whenever I DONT USE MY SEARCH BUTTON I GET UNIDENTIFIED ERROR cause it's underneath a IF function.. How do i stop the error if no1 is pressing my search button from $_POST['search'] on my form Quote Link to comment Share on other sites More sharing options...
Gayner Posted November 30, 2009 Author Share Posted November 30, 2009 if (isset($_POST['search']) AND $_POST['search']) $search_string = strtolower( str_replace( "*" , "%", $_POST['search'] ) ); $search_string = preg_replace( "/[<>\!\@£\$\^&\+\=\=\[\]\{\}\(\)\"';\.,\/]/", "", $search_string ); echo $search_string; But whenever I DONT USE MY SEARCH BUTTON I GET UNIDENTIFIED ERROR cause it's underneath a IF function.. How do i stop the error if no1 is pressing my search button from $_POST['search'] on my form lol i will just use this unless easier way? error_reporting(E_ERROR | E_WARNING | E_PARSE); Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 30, 2009 Share Posted November 30, 2009 your code should be if (isset($_POST['search'])) { $search_string = strtolower( str_replace( "*" , "%", $_POST['search'] ) ); $search_string = preg_replace( "/[<>\!\@£\$\^&\+\=\=\[\]\{\}\(\)\"';\.,\/]/", "", $search_string ); echo $search_string; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.