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 Link to comment https://forums.phpfreaks.com/topic/183360-stupid-search-problem-easy-fix/ 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); Link to comment https://forums.phpfreaks.com/topic/183360-stupid-search-problem-easy-fix/#findComment-967845 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; } Link to comment https://forums.phpfreaks.com/topic/183360-stupid-search-problem-easy-fix/#findComment-967851 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.