using forms to add records to mysql database - block submit on entering

D

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?
 
B

BootNic

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:

http://www.leadhoster.com/signup.html
http://www.zendurl.com/register.html
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*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top