using forms to add records to mysql database - block submit on entering
am 06.09.2007 16:16:14 von Dirk
Hey,
I'm new to php(and HTML) and I'm trying to write some php code so that
I can
insert data into a mysql database using html forms.
I've got two text forms and a submit button. When entering data and
selecting 'submit' a new record in my database is created. So far so
good... But when I enter data in only one content and hit the enter
key a new record is created with one empty field. And that something
I
don't want to happen.
Is there a way to block the text-forms so only a record is added when
I hit the 'submit' button?
Re: using forms to add records to mysql database - block submit on entering
am 06.09.2007 17:57:09 von BootNic
dirk wrote:
news:1189088174.396420.267840@y42g2000hsy.googlegroups.com:
> Hey,
> I'm new to php(and HTML) and I'm trying to write some php code so that
> I can insert data into a mysql database using html forms.
>
> I've got two text forms and a submit button. When entering data and
> selecting 'submit' a new record in my database is created. So far so
> good... But when I enter data in only one content and hit the enter
> key a new record is created with one empty field. And that something
> I don't want to happen.
URL? Create an example and supply a url. Need a host for your example?
Free host with mysql, php, no adds:
[url] http://www.leadhoster.com/signup.html [/url]
[url] http://www.zendurl.com/register.html [/url]
> Is there a way to block the text-forms so only a record is added when
> I hit the 'submit' button?
Form validation may be what you're looking for.
Client side validation using javascript, not dependable but may save a trip
or two to the server and for the ones that do not have javascript disable,
a convenience.
With or without client side validation, use server side validation. Google
is your friend. Search for it.
After you have searched and created an example, if you still need help post
to an appropriate newsgroup.
For client side form validation perhaps comp.lang.javascript, for php form
validation perhaps comp.lang.php.
FYI: Providing an example url and knowing the question to ask will make a
difference, and may prevent you being bounced from group to group.
--
BootNic Thursday September 6, 2007 11:56 AM
The more you find out about the world, the more opportunities there
are to laugh at it.
*Bill Nye*
*Mel Brooks*