2 things: enter doesn't work in IE & empty form


Posted on 16th Feb 2014 07:03 pm by admin

i have this search form that works well except for 2 things.

1) on IE when i hit enter instead of the Submit button, i do not get any result. with firefox, no problem.
2) when i hit submit or enter without putting anything on the search form, it outputs All data from the database.

any help to fix the issue?

Line number On/Off | Expand/Contract <script type="text/javascript" language="JavaScript">function countryempty(){ if ( document.form.country.value == '' ) { alert('No search was entered!') return false; }}</script> <?$country = $_POST["country"]; // if page is not submitted to itself echo the formif (!isset($_POST['submit'])) { ?> <form method="POST" action="<? echo $PHP_SELF; ?>" onSubmit="return countryempty();"> <p><b>SEARCH</b> a City or Country <input type="text" name="country" size="32"><p> <p>
<input type="submit" value="submit" name="submit"><input type="reset" value="Reset" name="B2"></p> </form> <? } else {?> <? $db_host = ''; $db_user = ''; $db_pass = ''; $db_name = '';$db_table = ''; $conn = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db($db_name,$conn); // The database query follows

No comments posted yet

Your Answer:

Login to answer
219 Like 20 Dislike
Previous forums Next forums
Other forums

Hashing?
Hi, I was hoping to take a string value then convert it - consistently - across each of our pages in

ldap connection
We are using ldap to get user information from the domain controller. It was working before. Recentl

PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page wi

Need help: how to catch acess of undefined class properties
Hello. I am learning OO with PHP and have hit a problem.
Some code runs as perfectly valid code,

help retrieiving results and doing pagination
Having some trouble trying to get the results to show on more than just one page.

What is ha

How would I do "Users not logged in since *** delete them"
I know how I would set this up, and delete the user roughly.
I'll create a table called "Use

How a counter of users ? such as ---> (231 Viewing)
I want to count how many users are actually viewing the page, How is that possible?
Thank you guy

if description does not contain the following words
Hello everyone,

I am parsing a MS Excel (.xls) file and adding it's content to a mySQL databa

PHP4 to PHP5 Conversion
Hi Everyone,

I am working on a site that is built up on PHP4 and each page is being started f

problem getting my contact form working
Yeah I know this is a pretty basic problem, but it's been a while since I've worked with PHP and I'm

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash