rondog Posted May 2, 2008 Share Posted May 2, 2008 How can I check if a user has searched ' ' or ' ' or however many amount of spaces..because right now if I search with just a space, it returns every item in my DB. Link to comment https://forums.phpfreaks.com/topic/103948-searching-for/ Share on other sites More sharing options...
hitman6003 Posted May 3, 2008 Share Posted May 3, 2008 if ($search_string == "" || str_replace(' ', '', $search_string) == "") { echo 'You must enter a search term'; } Link to comment https://forums.phpfreaks.com/topic/103948-searching-for/#findComment-532167 Share on other sites More sharing options...
DarkWater Posted May 3, 2008 Share Posted May 3, 2008 $trimmed = trim($_POST['search']); Something like that. Then: if ($trimmed = '') { echo "Please enter a search term."; } else { //SQL stuff } Link to comment https://forums.phpfreaks.com/topic/103948-searching-for/#findComment-532168 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.