pioneerx01 Posted January 2, 2011 Share Posted January 2, 2011 I have this search page that I am working on that works as it should in Firefox, but not at all in IE. Basically if I search for letters 'lee' in any capitalization form I get all the results with anyone having the letters 'lee' in their name, (in that order). But nothing in IE. Since I am not PHP expert I do not know what is wrong. Can anyone help? if(isset($_POST['submit'])) { if(isset($_GET['go'])){ if(preg_match("/^[ a-zA-Z0-9-]+/", $_POST['name'])) $name=trim($_POST['name']);{ $db=mysql_connect ("", "", "") or die ('I cannot connect to the database because: ' . mysql_error()); $mydb=mysql_select_db(""); $sql=" SELECT * FROM Project_Registrations WHERE first_name1 LIKE '%" . $name . "%' OR last_name1 LIKE '%" . $name . "%' OR first_name_2 LIKE '%" . $name . "%' OR last_name_2 LIKE '%" . $name . "%' OR first_name_3 LIKE '%" . $name . "%' OR last_name_3 LIKE '%" . $name . "%' OR project LIKE '%" . $name . "%' OR teacher_name LIKE '%" . $name . "%' OR school_name LIKE '%" . $name . "%' ORDER BY school_name "; $result=mysql_query($sql); echo mysql_error(); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo " --rest of the code-- ($_GET['go']) comes from URL that is send by other page Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/ Share on other sites More sharing options...
Pikachu2000 Posted January 2, 2011 Share Posted January 2, 2011 Post the form code also. Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153683 Share on other sites More sharing options...
PFMaBiSmAd Posted January 2, 2011 Share Posted January 2, 2011 Any chance your form is using an image as a submit button (or has some invalid HTML in it that FF is ignoring the error in, but IE is not)? Edit: I either need to read faster, type faster, or hit the post button faster.... Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153684 Share on other sites More sharing options...
pioneerx01 Posted January 2, 2011 Author Share Posted January 2, 2011 It is not PHP, but here it is: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Search Contacts</title> </head> <p><body> <h3>Search Contacts Details</h3> <p>You may search either by first or last name</p> <form method="post" action="search.php?go" id="searchform"> <input type="text" name="name"> <input type="submit" name="submit" value="Search"> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153687 Share on other sites More sharing options...
Pikachu2000 Posted January 2, 2011 Share Posted January 2, 2011 Since you're using both POST and GET, try printing both arrays to see if the values you expect to be there are actually there. Put the following code prior to the if(isset($_POST['submit'])) echo 'GET:'; echo '<pre>'; print_r($_GET); echo '</pre>'; echo 'POST:'; echo '<pre>'; print_r($_POST); echo '</pre>'; Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153691 Share on other sites More sharing options...
pioneerx01 Posted January 2, 2011 Author Share Posted January 2, 2011 Hey it works! thanks a lot. Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153698 Share on other sites More sharing options...
.josh Posted January 2, 2011 Share Posted January 2, 2011 the form code looks okay and the php code you posted looks okay...I'm thinking that it's submitting and querying just fine but maybe not displaying results correctly in IE. Post more code, the part you snipped and put "echo " --rest of the code--" Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153700 Share on other sites More sharing options...
pioneerx01 Posted January 2, 2011 Author Share Posted January 2, 2011 Ok, the code works but I am having relative issues to IE (again) So I type in 'Jim' into search box (in IE) click search I get nothing. I hit the back button and hit search again and there are the results. What is up with the two step program? Firefox still works well. Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153710 Share on other sites More sharing options...
PFMaBiSmAd Posted January 2, 2011 Share Posted January 2, 2011 I recommend that you echo the $sql variable so that you can see exactly what your query is. I suspect that register_globals are on and you have either a session variable or a cookie variable (that is only set in IE) with the same name as one of your post/get variables from the form. Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153713 Share on other sites More sharing options...
.josh Posted January 2, 2011 Share Posted January 2, 2011 the form code looks okay and the php code you posted looks okay...I'm thinking that it's submitting and querying just fine but maybe not displaying results correctly in IE. Post more code, the part you snipped and put "echo " --rest of the code--" Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153717 Share on other sites More sharing options...
pioneerx01 Posted January 2, 2011 Author Share Posted January 2, 2011 Ok here is the entire code (rest is a little complicated): <table id="s_main_table"> <?php "echo 'GET:'; echo '<pre>'; print_r($_GET); echo '</pre>'; echo 'POST:'; echo '<pre>'; print_r($_POST); echo '</pre>';" ?> <?php if(isset($_POST['submit'])) { if(isset($_GET['go'])){ if(preg_match("/^[ a-zA-Z0-9-]+/", $_POST['name'])) $name=trim($_POST['name']);{ $db=mysql_connect ("", "", "") or die ('I cannot connect to the database because: ' . mysql_error()); $mydb=mysql_select_db(""); $sql=" SELECT * FROM Project_Registrations WHERE first_name1 LIKE '%" . $name . "%' OR last_name1 LIKE '%" . $name . "%' OR first_name_2 LIKE '%" . $name . "%' OR last_name_2 LIKE '%" . $name . "%' OR first_name_3 LIKE '%" . $name . "%' OR last_name_3 LIKE '%" . $name . "%' OR project LIKE '%" . $name . "%' OR teacher_name LIKE '%" . $name . "%' OR school_name LIKE '%" . $name . "%' ORDER BY school_name "; $result=mysql_query($sql); echo mysql_error(); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo " <tr><td colspan='4' ID='s_first'></td></tr> <tr><td ID='s_fix'>School Name</td><td colspan='3' ID='s_fixb'>{$row['school_name']}</td></tr> <tr><td ID='s_fix'>Teacher Name</td><td colspan='3' ID='s_fixb'>{$row['teacher_name']}</td></tr> <tr><td ID='s_fix'>Project Title</td><td colspan='3' ID='s_fixb'>{$row['project_title']}</td></tr> <tr><td ID='s_fix'>Project Number</td><td colspan='3' ID='s_fixb'>{$row['project']}</td></tr> <tr><td ID='s_fix'>Form Submission</td><td colspan='3' ID='s_fixb'>"; if ($row['form']=="No") echo "<span ID='s_no'>NO</span> (<a href='#'>print them out now</a>)"; else echo "<span ID='s_yes'>Yes</span>"; echo"</td></tr> <tr><td colspan='4' ID='s_mid'></td></tr> <tr><td ID='s_fix_2'>Registered Students</td><td ID='s_fix_3'>Photo Release Form</td><td ID='s_fix_4'>Paid</td><td ID='s_side'"; if ($row['first_name_2']!="" and $row['first_name_3']!="") echo "rowspan='4'"; else echo ""; if ($row['first_name_2']!="" and $row['first_name_3']=="") echo "rowspan='3'"; else echo ""; if ($row['first_name_2']=="" and $row['first_name_3']=="") echo "rowspan='2'"; else echo ""; if ($row['paid1']=="No") echo "align='center' style='color:#FF0000'>If student does not have their payment in by our <a href='#'>deadlines</a>,<br/> they will not be able to participate in 2011 AzSEF"; else echo""; if ($row['paid1']=="Yes" and $row['paid2']=="No" and $row['first_name_2']!="") echo "align='center' style='color:#FF0000'>If student does not have their payment in by our <a href='#'>deadlines</a>,<br/> they will not be able to participate in 2011 AzSEF"; else echo""; if ($row['paid1']=="Yes" and $row['paid2']=="Yes" and $row['paid3']=="No" and $row['first_name_3']!="") echo "align='center' style='color:#FF0000'>If student does not have their payment in by our <a href='#'>deadlines</a>,<br/> they will not be able to participate in 2011 AzSEF"; else echo""; echo"</td></tr> <tr><td ID='s_fix_2b'>{$row['first_name1']} {$row['last_name1']}</td><td ID='s_fix_3b'>"; if ($row['pr']=="No") echo "<span ID='s_no'>NO</span> (<a href='#'>print out one now</a>)"; else echo "<span ID='s_yes'>Yes</span>"; echo"</td><td ID='s_fix_4b'>"; if ($row['paid1']=="No") echo "<span ID='s_no'>NO</span> (<a href='#'>pay now</a>)"; else echo "<span ID='s_yes'>Yes</span>"; echo""; if ($row['first_name_2']=="") echo ""; else echo "<tr><td ID='s_fix_2b'>{$row['first_name_2']} {$row['last_name_2']}</td><td ID='s_fix_3b'>"; if ($row['pr2']=="Yes" and $row['first_name_2']!="") echo "<span ID='s_yes'>Yes</span>"; else echo ""; if ($row['pr2']=="No" and $row['first_name_2']!="") echo "<span ID='s_no'>NO</span> (<a href='#'>print out one now</a>)"; else echo ""; echo" </td><td ID='s_fix_4b'>"; if ($row['paid2']=="Yes" and $row['first_name_2']!="") echo "<span ID='s_yes'>Yes</span>"; else echo ""; if ($row['paid2']=="No" and $row['first_name_2']!="") echo "<span ID='s_no'>NO</span> (<a href='#'>pay now</a>)"; else echo ""; echo" </td><td></td></tr>"; echo""; if ($row['first_name_3']=="") echo ""; else echo "<tr><td ID='s_fix_2b'>{$row['first_name_3']} {$row['last_name_3']}</td><td ID='s_fix_3b'>"; if ($row['pr3']=="Yes" and $row['first_name_3']!="") echo "<span ID='s_yes'>Yes</span>"; else echo ""; if ($row['pr3']=="No" and $row['first_name_3']!="") echo "<span ID='s_no'>NO</span> (<a href='#'>print out one now</a>)"; else echo ""; echo" </td><td ID='s_fix_4b'>"; if ($row['paid3']=="Yes" and $row['first_name_3']!="") echo "<span ID='s_yes'>Yes</span>"; else echo ""; if ($row['paid3']=="No" and $row['first_name_3']!="") echo "<span ID='s_no'>NO</span> (<a href='#'>pay now</a>)"; else echo ""; echo" </td><td></td></tr>"; echo" <tr><td colspan='4' ID='s_last'></td></tr>" ;}}}} echo "</table>" ?> And yes I do not have nothing found as results if nothing is found... Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153719 Share on other sites More sharing options...
pioneerx01 Posted January 2, 2011 Author Share Posted January 2, 2011 So, does anyone know why is it take two searches is IE to show the results? Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153969 Share on other sites More sharing options...
PFMaBiSmAd Posted January 2, 2011 Share Posted January 2, 2011 I don't see yet where you echoed the query in $sql so that you know what your query actually is as that would help determine why it doesn't match anything. Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153976 Share on other sites More sharing options...
fortnox007 Posted January 2, 2011 Share Posted January 2, 2011 also you have a paragraph in front of your body tag and if i am correct thats a no go <p><body> Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1153977 Share on other sites More sharing options...
pioneerx01 Posted January 3, 2011 Author Share Posted January 3, 2011 I have fixed the <p> tag issue, but that is not what is throwing it all off. PFMaBiSmAd: I am not sure what you want me to do. Can you dumb it down for me (beginner here) or better yet show me? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1154095 Share on other sites More sharing options...
PFMaBiSmAd Posted January 3, 2011 Share Posted January 3, 2011 After you form the $sql variable in your code - echo $sql; Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1154166 Share on other sites More sharing options...
the182guy Posted January 3, 2011 Share Posted January 3, 2011 If I had a penny for everytime I said this.... if(isset($_POST['submit'])) is NOT fully compatible with IE. If using IE and the user pressed the enter key to submit the form, IE will not send the submit button as a form input and thus your code won't detect the fact that the form is submitted because isset($_POST['submit']) is false. Use if($_SERVER['REQUEST_METHOD'] == 'POST') Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1154173 Share on other sites More sharing options...
pioneerx01 Posted January 4, 2011 Author Share Posted January 4, 2011 the182guy: You are fantastic! The issue is now resolved. Thank you all very much for helping me with this. Quote Link to comment https://forums.phpfreaks.com/topic/223167-this-code-is-not-ie-compatibe-shocker-i-know/#findComment-1154490 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.