473,785 Members | 3,349 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
4 5885
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
On 6 sep, 15:40, Captain Paralytic <paul_laut...@y ahoo.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
On Thu, 06 Sep 2007 16:08:35 +0200, dirk <di******@gmail .comwrote:
On 6 sep, 15:40, Captain Paralytic <paul_laut...@y ahoo.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.javas cript
in case user side scripting is needed).
--
Rik Wasmus
Sep 6 '07 #4
..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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2624
by: R.G. Vervoort | last post by:
I would like to select an option in a pulldown, select a record in a mysql database depending on the pulldown selection and then put the data from the record in the textfields. I can retrieve the pulldown value using javascript I can open the database and select the record using php how can i combine the 2 to within the onchange option of the pull down.
2
3450
by: Sam White | last post by:
I have set up a MySQL db on one server, IIS 6.0 on another. Using Frontpage I created some forms to input data. On a test page I made, I have 4 fields. First is the ID which is autonumber (I leave alone). The second is marked as TEXT, the third is MEDIUMTEXT, and the fourth is DATE. This is just an example though, the problem exists in no matter what manner I create the form. Now here is the issue. In the TEXT fields nothing is saved...
11
4441
by: pmarisole | last post by:
I am trying to use the vbscript "split" function on a multi-select field. I am trying to do a mass update of several records at a time. I am getting an error and I'm not sure what to do. Here is the code if someone could help... strID = split(request.form("proj"), ", ") projstat = split(request.form("rojstat"),",") impr = split(request.form("impr"),",") idate =...
3
3128
by: Bob Sanderson | last post by:
I am trying to create a form for a MySQL database similar to a spreadsheet. The idea is to display a list of records, with the last line of the list being an input form. When the user enters data in the form and hits the submit button, the data is entered and the form is reloaded with the new data displayed and another input form becomes the last line. Example --- Before entering new data
2
4402
by: azmiza | last post by:
Hi everybody, I need your help. I want to view my sql database and its work very well which is display in my web browser but once I want to press button yes, its not working, I check the database the specified row was nit deleted Here I put my script for both. <?php #script view_users.php pg 279
3
2882
by: WiseG1rly | last post by:
Hey everyone! I am completley new and I will start off by saying that I am not a programmer - figuring out this search took so long! I am debugging now and would appreciate any help :) Anyways, I am creating a website where I have a database of pet listings in california. Each record lists the Type of Listing (eg. dog grooming or vet) the the Area it is in (so state, county etc.), a Name, Description, and Address. I created a search...
221
367739
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application needs to store entire files, the preferred method is to save the file onto the server’s file-system, and store the physical location of the file in your database. This is generally considered to be the easiest and fastest way to store files. ...
1
4610
by: javediq143 | last post by:
Hi All, This is my first post in this forum. I'm developing a CMS for my latest website. This CMS is also in PhP & MySQL. I'm done with the ADD section where the Admin can INSERT new records in Database but I'm stuck in the EDIT. I'm getting 2 problems over here. Below is the description: 1)The FIRST page will list all the records from the table which Admin can EDIT with CHECKBOX for each record to select. He can select one or more than one...
13
26935
by: ramprakashjava | last post by:
hi, i hav "java.lang.NullPointerException" error while Deleting table records using checkbox in jsp here i enclosed files help quickly plzzz.. Regards Ramprakash /*Adminpage.jsp*/ <%@ page language="java" import="java.sql.*"%> <html> <head>...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9947
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.