avincent Posted November 11, 2009 Share Posted November 11, 2009 I have written the following code and it works perfectly in all browsers except IE (all versions). In all other browsers you can get the table with the database info to display, but not in IE. Any suggestions? <div id="width"> <div class="float-right no-border"><h1>Live Chat </h1> <script language="JavaScript" src="http://trial1.phplivesource.com/js/status_image.php?base_url=http://trial1.phplivesource.com&l=deiandrew&x=9544&deptid=7804&"><a href="http://www.phplivesource.com"></a></script></div> <div class="float-left"><h2>Technical Issues</h2> <p>Blah Blah Blah somekind of welcome to technical issues section goes here</p> <p>Remember we also have a live chat available that you can access with the link on the right side. If the icon is red that means that we are either out of the office or in a meeting, but you can still click on it and leave us a message so we can get back to you at the email address you provided. If the link is green then we are here and ready to take your questions. </p> <p></p><p> </p> <p> <a href="instructional-videos.php">Instructional Videos</a> - <a href="printable-materials.php">Printable Materials</a> - <a href="client-faqs.php">Faq's</a> - <a href="technical-issues.php">Technical Issues</a> - <a href="ask-a-tech.php">Ask a Tech</a> - <a href="settings.php">Settings</a></p> <p></p><p> </p> </div> <table width="970"> <tr> <th valign="top" width="160">Company Name</th> <th valign="top" width="160">Domain Name</th> <th valign="top" width="120">Completed Yes/No</th> <th valign="top" width="450">Comments</th> </tr> <?php //Create registration form (register.php) include ("db_connect.php"); if(isset($_POST['submit'])){ $sql=''; $search=$_POST['search']; if($_POST['search'] != '') { $sql="SELECT * FROM `online-form` WHERE `domain-name` LIKE '%" . $search . "%'"; } //-run the query against the mysql query function for all except domain search $result=''; if($sql != '') { $result=mysql_query($sql); } else { echo "<p>How can I search when you dont enter anything in?</p>"; } //-create while loop and loop through result set for all except domain search if($result != '') { while($row=mysql_fetch_array($result)){ $name=$row['name']; $domain=$row['domain-name']; $completed=$row['completed']; $comments=$row['comments']; echo "<tr>"; echo "<td>"; echo $name; echo "</td>"; echo "<td>"; echo $domain; echo "</td>"; echo "<td>"; echo "<font size=\"+1\"><strong>"; echo $completed; echo "</strong></font>"; echo "</td>"; echo "<td>"; echo $comments; echo "</td>"; echo "</tr>";} } else { echo "nothing to display";} } ?> </table><br /><br /> <div id="container-form"> <form action="export.php" method="post"> <input type="submit" name="submit" id="submit" value="Export Complete List to XLS" /> </form> <br /><br /> <form action="search-results.php" method="post"> <input type="textbox" name="search" id="search" /> <input type="submit" name="submit" id="submit" value="Search Again" /> </form> </div> </div> Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted November 11, 2009 Share Posted November 11, 2009 well, it's obviously a display issue. if you look at the source (view source) in the browser, where does the page break? Quote Link to comment Share on other sites More sharing options...
avincent Posted November 11, 2009 Author Share Posted November 11, 2009 The source code shows that it displays the first row of the table with the table headers, then jumps to the close table tag and the rest of the code, but will not display anything within the PHP tags. Quote Link to comment Share on other sites More sharing options...
avincent Posted November 11, 2009 Author Share Posted November 11, 2009 I also put in a testing echo "testing"; just before the include tag of the php and it did display that, but it displayed it on the page before the table. not after the first row as the order of the code. Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted November 11, 2009 Share Posted November 11, 2009 there is probably something being returned from the database that is messing up the display in IE. other browsers tend to automatically correct or ignore bad HTML (at times). for example, $comments might have some bad characters in it causing the HTML to break in IE. check within the database to see if there is anything that might cause the HTML to parse differently in IE. also, if there are no returned results, you have this "<p>How can I search when you dont enter anything in?</p>"; however, this will be parsed and show up like this: //table stuff... </tr> <p>How can I search when you dont enter anything in?</p> </table> when everything is pieced together. change <p>How can I search when you dont enter anything in?</p> to: <tr><p>How can I search when you dont enter anything in?</p></tr> to at least keep with the integrity of the table format. you should really change the following: <?php if($_POST['search'] != '') { $sql="SELECT * FROM `online-form` WHERE `domain-name` LIKE '%" . $search . "%'"; } //-run the query against the mysql query function for all except domain search $result=''; if($sql != '') { $result=mysql_query($sql); } else { echo "<p>How can I search when you dont enter anything in?</p>"; } ?> to: <?php $search = (((isset ($_POST['search'])) || (!empty ($_POST['search']))) ? mysql_real_escape_string ($_POST['search']) : false); if (!$search)) { echo "<tr><p>How can I search when you dont enter anything in?</p></tr>"; } else { $sql = "SELECT * FROM `online-form` WHERE `domain-name` LIKE '%" . $search . "%'"; $result = mysql_query ($sql); } ?> Quote Link to comment Share on other sites More sharing options...
avincent Posted November 11, 2009 Author Share Posted November 11, 2009 This is the one row I have in the database: name phone domain-name email comments completed XXXX Inc 7273680270 XXXX.com support@XXXX.com testing, testing, yes I don't see anything wrong with these entries. I also implemented your code suggestion and I am still having the same problem. Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted November 11, 2009 Share Posted November 11, 2009 here, took the liberty of changing up your PHP a bit: <?php //Create registration form (register.php) if (isset ($_POST['submit'])) { $search = (((isset ($_POST['search'])) || (!empty ($_POST['search']))) ? mysql_real_escape_string ($_POST['search']) : false); if (!$search) { echo "<tr><p>How can I search when you dont enter anything in?</p></tr>"; } else { $sql = "SELECT * FROM `online-form` WHERE `domain-name` LIKE '%{$search}%'"; $result = mysql_query ($sql); //-create while loop and loop through result set for all except domain search if (mysql_num_rows ($result) > 0) { while ($row = mysql_fetch_array($result)) { $name = $row['name']; $domain = $row['domain-name']; $completed = $row['completed']; $comments = htmlentities ($row['comments'], ENT_QUOTES); echo <<<RESULTS <tr> <td>{$name}</td> <td>{$domain}</td> <td><strong>{$completed}</strong></td> <td>{$comments}</td> </tr> RESULTS; } } else { echo "<tr><p>nothing to display</p></tr>";} } } ?> when you are submitting a search, are you typing in the query term and pressing enter? or are you actually clicking the "Search Again" button? Quote Link to comment Share on other sites More sharing options...
avincent Posted November 11, 2009 Author Share Posted November 11, 2009 I was just hitting the enter key, but once I tried to actually click the submit button it does work and the row does display. Do you know how to get around that? having to click the button is a tough thing to ask the user. Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted November 11, 2009 Share Posted November 11, 2009 ya, seems Internet Explorer does not send the name/value of the submit button with the form. instead of: if (isset ($_POST['submit'])) do: if (isset ($_POST['search'])) here, might as well make a few other changes, too: new PHP code; <?php //Create registration form (register.php) if ((isset ($_POST['search'])) || (!empty ($_POST['search']))) { $search = mysql_real_escape_string ($_POST['search']); $sql = "SELECT * FROM `online-form` WHERE `domain-name` LIKE '%{$search}%'"; $result = mysql_query ($sql); //-create while loop and loop through result set for all except domain search if (mysql_num_rows ($result) > 0) { while ($row = mysql_fetch_array($result)) { $name = $row['name']; $domain = $row['domain-name']; $completed = $row['completed']; $comments = htmlentities ($row['comments'], ENT_QUOTES); echo <<<RESULTS <tr> <td>{$name}</td> <td>{$domain}</td> <td><strong>{$completed}</strong></td> <td>{$comments}</td> </tr> RESULTS; } } else { echo "<tr><p>nothing to display</p></tr>";} } else { echo "<tr><p>How can I search when you dont enter anything in?</p></tr>"; } ?> Quote Link to comment Share on other sites More sharing options...
avincent Posted November 11, 2009 Author Share Posted November 11, 2009 I did a bit of searching and found that this is a pretty well know IE bug, which I am sure you already knew about. IE will not allow you to hit enter to submit a form if there is only one input tag. I put the following in my submission form and it is working like a charm now. <input type="text" style="display: none;" disabled="disabled" size="1" /> 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.