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.
Did you know?Explore Trending and Topic pages for more stories like this.

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

problem with GROUP BY and ORDER BY
i usually use this query to display the last 10 entries from a sql table:

Code: $query = &quo

is_dir() problem
Hello,

I'm buidling a php scripts that dynamically get's subfolders from a specific folder.

The type or namespace name 'ServiceModel' does not exist in the namespace 'System'
When I locally run the website, it works just fine, but when I uploaded it to the hosting environmen

query based on 2 conditions
I want to select if the doc_type is either s OR f but this doesn't work:

Code: [Select]$query

Forum tutorial
Im a beginner in PHP. Im making a forum(previous questbook, counter and few others) to learn. For no

The repetition structure: the while statement not working
New programming student, have assignment as follows:
A restaurant has 4 lunch combos for custom

Adding post count
How would I make it so everytime someone clicks submit on my form, their row in the database for the

how to get different value in second view of webdynpro?
hello guys,

In ABAP webdynpro I am trying to create one application having two views.

Converting from one format to another
"I have got a date in DD/MM/YYYY but I need it in MM-DD-YYYY. Help!"

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

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