Hi,
Bizarre problem with a very basic php search form/script that only seems to show up in IE7.
If I fill in the search box and press the Enter key on the keyboard, the form appears to submit (the search box is cleared as if the page is refreshed, which is what should happen since this same page is also supposed to process the form). However, the query is never processed by the PHP script on the page. If I click the submit button, everything is fine.
Below is my form HTML and the PHP.
[code=php]
<div class=”searchBox”>
<form id=”databasesearch” name=”databasesearch” method=”post” action=””>
<input name=”searchquery” type=”text” id=”searchquery” size=”30″ value=””/>
<input type=”submit” name=”search” id=”search” value=”Find” />
</form>
</div>
<div class=”resultsarea”>
<ul>
<?php
require (‘../mysql_connect.inc’);
if (isset($_POST[‘search’])) {
$query = “select metalib_id, title_display from xerxes_databases where title_display LIKE ‘%{$_POST[‘searchquery’]}%’ order by title_display”;
$result = mysql_query($query);
if (mysql_num_rows($result) > 0) {
while ($database = mysql_fetch_array ($result, MYSQL_ASSOC)) {
echo “<li><a href=”http://aleph19.pacific.edu/_metasearch/databases/proxy/$database[metalib_id]”>$database[title_display]</a></li>”;
}
} else {
echo “<div align=”center” style=”color: #cc0000; font-weight: bold”>Sorry. There were no results for <span style=”color: black”>"{$_POST[‘searchquery’]}"</span>.</div>”;
}
}
?>
</ul>
</div>
Any ideas as to why IE7 won’t process the PHP if you press the Enter key?
Thanks,
Glenn