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

Probably Easy, Need help with Check Boxes in PHP Code
hello,

Thanks for looking this over and helping me out. My problem is I have a online store l

Problem Dereferencing
With these types and tables:

CREATE TYPE MANAGER AS OBJECT (
MGR_ID INTEGER,

str_replace help
Hey there,

I'm a PHP newb, I'm having troubles with the str_replace function. I want to clean

a multi dimensional array with for each
hi, I have been asked to write an array, I have Zone 2,3,4,5,6,7,8 each zone has 3 sections of weigh

Download Image from URL and Upload it
Ok, I have been googling for the last 1/2 hour trying to figure this out, Most likely I'm just not s

error checking breaking my code
Hi there, OK first of all, big apologies for what I assume is really fundamental errors in the struc

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

Upload file and add HTML
Hey everyone,

I have a client has meeting agendas and minutes that should be posted online. I

Bit manipulation program with binary operations
My homework is to create a program to scan in and add binary numbers and print them like so

Count on multidimensional array
Hi, i got an array as below:

Array
(
=> Array
(

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