By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,289 Members | 1,457 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,289 IT Pros & Developers. It's quick & easy.

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

P: n/a
Hey,

I'm new to php 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?

Sep 6 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 6 Sep, 14:19, dirk <dirkh...@gmail.comwrote:
Hey,

I'm new to php 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?
This is an HTML forms question. Nothing to do with PHP.

Sep 6 '07 #2

P: n/a
On 6 sep, 15:40, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 6 Sep, 14:19, dirk <dirkh...@gmail.comwrote:
Hey,
I'm new to php 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?

This is an HTML forms question. Nothing to do with PHP.
Could be. Does this mean that you don't have the answer to this?

Sep 6 '07 #3

P: n/a
On Thu, 06 Sep 2007 16:08:35 +0200, dirk <di******@gmail.comwrote:
On 6 sep, 15:40, Captain Paralytic <paul_laut...@yahoo.comwrote:
>On 6 Sep, 14:19, dirk <dirkh...@gmail.comwrote:
Hey,
I'm new to php 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?

This is an HTML forms question. Nothing to do with PHP.

Could be.
Is so :P
Does this mean that you don't have the answer to this?
Nobody HAS to, it's just far more likely you'll get a correct, speedy, and
friendly answer in alt.html for instance (or possibly comp.lang.javascript
in case user side scripting is needed).
--
Rik Wasmus
Sep 6 '07 #4

P: n/a
..oO(dirk)
>I'm new to php 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.
Use your PHP script to check that all required values are there and
reject the form submission if something is missing. Show an error
message and the form with all previously entered values again.
>Is there a way to block the text-forms so only a record is added when
I hit the 'submit' button?
No. Don't even try it. Fix it on the server.

Micha
Sep 6 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.