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
20
Other forums
reading partial code from external site
Hi,
I am trying to write a script for my website to get an article from an external website.
Send inserts to mysql thru port 80
Hi!
I have an application that must do some inserts in a mysql db. This db is behind a firewa
socket communication between c++/java and sending image
hi,
i have a class in c++ called win32_sockserver which creates socket to java. i am trying
Search function
I am looking for some guidance from the experts.
I am trying to create a search function. It
ASP.NET 2.0 - Enter Key - Default Submit Button
Hi,One of the most annoying things in developing web pages is handling the "Enter key" for form subm
Can't find the problem (no error message)!
OK, here's the deal. This code is really weirdly formatted (sorry!) and hard to understand, so I'm g
UDS 4.0 Datatype issue
UDS 4.0.322 -- connecting to NI Labview 9.0
When using connection method: Cache with live
Problem with passing variables
I'm not really a php programmer so I'm really struggling with this issue.
I have a banner s
php wont update my db
hello,
sorry for posting in mysql forum but i dont know where exactly is the problem but here
xml
<?php
echo "<h1>XML Articles</h1>";
$home