izbryte Posted January 9, 2008 Share Posted January 9, 2008 This is a script where user can search jobs by selecting a location or category and entering a search keyword. It works fine in Mozilla but turns up nothing in IE? Can anyone help me? if (isset($_POST['Search'])) { $query = "SELECT * FROM jobs WHERE NOW() < expires AND paid = 'yes' "; $keyword = trim($_POST['keyword']); if($_POST['keyword']!=''){ $find = mysql_real_escape_string(htmlentities($_POST['keyword'])); $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); if(($_POST['category']!='')&&($_POST['location']!='')){ $query .= "AND category = '".mysql_real_escape_string($_POST['category'])."' OR location = '".mysql_real_escape_string($_POST['location'])."' OR title LIKE '%$find%'"; $search = TRUE; } elseif(($_POST['category']!='')&&($_POST['location']=='')){ $query .= "AND category = '".mysql_real_escape_string($_POST['category'])."' OR title LIKE '%$find%'"; $search = TRUE; } elseif(($_POST['category']=='')&&($_POST['location']!='')){ $query .= " AND location = '".mysql_real_escape_string($_POST['location'])."' OR title LIKE '%$find%'"; $search = TRUE; } else { $query .= "AND title LIKE '%$find%'"; $search = TRUE; } } else{ if($_POST['location']!=''){// Check if the location isnt empty if($_POST['category']==''){ // Check if category is empty $query .= "AND location = '".mysql_real_escape_string($_POST['location'])."'"; $search = TRUE; }// End if category is empty }// End if location isnt empty if($_POST['category']!=''){// Check if the category isnt empty if($_POST['location']==''){ // Check if location is empty $query .= "AND category = '".mysql_real_escape_string($_POST['category'])."'"; $search = TRUE; }// End if location is empty }// End if category isnt empty if($_POST['category']!=''){// Check if the category isnt empty if($_POST['location']!=''){ // Check if location is empty $query .= "AND category = '".mysql_real_escape_string($_POST['category'])."' AND location = '".mysql_real_escape_string($_POST['location'])."'"; $search = TRUE; }// End Else }// End if location isnt empty }// End if category isnt empty if($search){ $aa = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($aa)){ echo $row['title']; }// End While }// End if Search is true else { echo 'No search term selected.'; } }// End if form was submitted Quote Link to comment https://forums.phpfreaks.com/topic/85238-solved-script-working-in-mozilla-but-not-ie/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 9, 2008 Share Posted January 9, 2008 You need to help us by telling us what works and what does not. Does the form work and submit the proper data? Does the query fail and execute your or die() statement? Does the search run but return zero results? Do you just get a blank screen? Does the form page just redisplay? Quote Link to comment https://forums.phpfreaks.com/topic/85238-solved-script-working-in-mozilla-but-not-ie/#findComment-434847 Share on other sites More sharing options...
izbryte Posted January 9, 2008 Author Share Posted January 9, 2008 In mozilla it comes out just fine with the proper results shown. In IE it just shows a blank screen. Quote Link to comment https://forums.phpfreaks.com/topic/85238-solved-script-working-in-mozilla-but-not-ie/#findComment-434871 Share on other sites More sharing options...
PFMaBiSmAd Posted January 9, 2008 Share Posted January 9, 2008 I would guess that your form either uses an image for the submit button or the form is invalid HTML. Either of these (and probably several more form problems that I did not mention) would cause different browsers to submit different data to the form processing code. Posting your form would allow someone to determine if it is where the problem is. Programs only do what the code tells them. In your posted code if (isset($_POST['Search'])) won't be true if $_POST['Search'] is not set, resulting in a blank page... Work back from there to find out what the problem is. Quote Link to comment https://forums.phpfreaks.com/topic/85238-solved-script-working-in-mozilla-but-not-ie/#findComment-434883 Share on other sites More sharing options...
tippy_102 Posted January 10, 2008 Share Posted January 10, 2008 My guess is a CSS issue. In IE, if you view the source does it show the results? Quote Link to comment https://forums.phpfreaks.com/topic/85238-solved-script-working-in-mozilla-but-not-ie/#findComment-435315 Share on other sites More sharing options...
roopurt18 Posted January 10, 2008 Share Posted January 10, 2008 http://www.phpfreaks.com/forums/index.php/topic,167898.0.html IE has an odd behavior dealing with form submits, check that as well. Quote Link to comment https://forums.phpfreaks.com/topic/85238-solved-script-working-in-mozilla-but-not-ie/#findComment-435401 Share on other sites More sharing options...
izbryte Posted January 10, 2008 Author Share Posted January 10, 2008 I would guess that your form either uses an image for the submit button That was it! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/85238-solved-script-working-in-mozilla-but-not-ie/#findComment-435615 Share on other sites More sharing options...
PFMaBiSmAd Posted January 10, 2008 Share Posted January 10, 2008 In case someone happens upon this thread, here is how php receives the form data when an image is used for the submit button - http://www.php.net/manual/en/faq.html.php#faq.html.form-image Apparently IE only sends the name_x and name_y, while other browsers send the name, name_x, and name_y variables. The solution is to look for the name_x and/or name_y, and not just the name variable. Quote Link to comment https://forums.phpfreaks.com/topic/85238-solved-script-working-in-mozilla-but-not-ie/#findComment-435635 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.