473,549 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capturing form input

I will try to be short and to the point.(good Luck) I have a form
written in HTML. I have a Mysql database. I am using a linux server
and I would like to use php to write the following code:

After the user inputs their name, address, email, phone, etc. in my
html form. They will hit the submit button. I need for the information
they entered to go into my database.

I have looked now for about 12 hours and haven't been able to find an
answer. I know I must be missing something since I've been to the w3
site, codewalkers, phpfreaks,php.n et(?), and many more.

If there is an easier way of doing this I would love to hear it.

If somene could point me in the right direction I could stop banging
my head and pulling my hair.

THANK YOU in advance for your advice.

Neil

Jun 16 '07 #1
4 1732

"Cigar2011" <ci*******@Yaho o.comwrote in message
news:11******** **************@ q69g2000hsb.goo glegroups.com.. .
>I will try to be short and to the point.(good Luck) I have a form
written in HTML. I have a Mysql database. I am using a linux server
and I would like to use php to write the following code:

After the user inputs their name, address, email, phone, etc. in my
html form. They will hit the submit button. I need for the information
they entered to go into my database.

I have looked now for about 12 hours and haven't been able to find an
answer. I know I must be missing something since I've been to the w3
site, codewalkers, phpfreaks,php.n et(?), and many more.

If there is an easier way of doing this I would love to hear it.

If somene could point me in the right direction I could stop banging
my head and pulling my hair.

THANK YOU in advance for your advice.
Its going to be more work and its going to take you some time to learn it.

1. You'll need a web server like apache, php, and an sql like mysql. They
are all free and easy to install with many online tutorials.

2. Get apache and php up and running with appropriate modules and
extensions. This should actually be part of 1.

3. Create some simple php scripts for testing. Again, there are online
tutorials for this.

4. Now try to get some mysql code working. Its actually very easy but you'll
need to learn the sql language which is also easy but at first might seem
hard.

5. Now work with php and forms. This is again very easy and there are many
online tutorials about how to do it.

6. Put everything you've learned together to do what you want.
---

Each step is actually very easy although they can be time consuming if you
get in trouble. Its best you learn how to do everything because it builds
character ;) Actually you'll be glad you learned it because its not
hard(Although it might seem that way) and you'll be in a much better
position to do things you want and how you want.

Since all the tools you need are free the only thing you have to pay is
time. Again, its not hard but it will take time for you to learn all the
little things. Give yourself a few months and you'll have it down. If your
diligent you could probably get enough done in a month or so.

Jon
Jun 16 '07 #2
Cigar2011 wrote:
I will try to be short and to the point.(good Luck) I have a form
written in HTML. I have a Mysql database. I am using a linux server
and I would like to use php to write the following code:

After the user inputs their name, address, email, phone, etc. in my
html form. They will hit the submit button. I need for the information
they entered to go into my database.

I have looked now for about 12 hours and haven't been able to find an
answer. I know I must be missing something since I've been to the w3
site, codewalkers, phpfreaks,php.n et(?), and many more.

If there is an easier way of doing this I would love to hear it.

If somene could point me in the right direction I could stop banging
my head and pulling my hair.

THANK YOU in advance for your advice.

Neil
The data from the form with go to the script named in the action
parameter of the form tag.

in that script the data will be in the $_POST array.

eg:

<form action="contact _manage.php" method="post">
<input type="text" name="fname" size="20" />
<input type="text" name="lname" size="20"/>
<input type="submit">

then in the script, "contact_manage .php"

$first_name = $_POST['fname'];
$last_name = $_POST['lname'];

But, don't even think about putting user supplied data directly
into the database. Bad things can happen.

http://us2.php.net/manual/en/securit...-injection.php

bill
Jun 16 '07 #3
On 16 Jun, 22:10, bill <nob...@spamcop .netwrote:
Cigar2011 wrote:
I will try to be short and to the point.(good Luck) I have a form
written in HTML. I have a Mysql database. I am using a linux server
and I would like to use php to write the following code:
After the user inputs their name, address, email, phone, etc. in my
html form. They will hit the submit button. I need for the information
they entered to go into my database.
I have looked now for about 12 hours and haven't been able to find an
answer. I know I must be missing something since I've been to the w3
site, codewalkers, phpfreaks,php.n et(?), and many more.
If there is an easier way of doing this I would love to hear it.
If somene could point me in the right direction I could stop banging
my head and pulling my hair.
THANK YOU in advance for your advice.
Neil

The data from the form with go to the script named in the action
parameter of the form tag.

in that script the data will be in the $_POST array.

eg:

<form action="contact _manage.php" method="post">
<input type="text" name="fname" size="20" />
<input type="text" name="lname" size="20"/>
<input type="submit">

then in the script, "contact_manage .php"

$first_name = $_POST['fname'];
$last_name = $_POST['lname'];

But, don't even think about putting user supplied data directly
into the database. Bad things can happen.

http://us2.php.net/manual/en/securit...-injection.php

bill- Hide quoted text -

- Show quoted text -
I came accross this little script today that should save a lot of the
effort. It creates the form for you and submits the data to your
database.

href=http://phpformgen.sour ceforge.net

got to sort the security bit though

Jun 16 '07 #4
In our last episode,
<11************ **********@q69g 2000hsb.googleg roups.com>,
the lovely and talented Cigar2011
broadcast on comp.lang.php:
I will try to be short and to the point.(good Luck) I have a form
written in HTML. I have a Mysql database. I am using a linux server
and I would like to use php to write the following code:
After the user inputs their name, address, email, phone, etc. in my
html form. They will hit the submit button. I need for the information
they entered to go into my database.
I have looked now for about 12 hours and haven't been able to find an
answer.
What answer? It seems you want the whole thing done for you, like it
is homework. What is the problem you are having? Are you unable
to get the data to your form handler? Funny because although this
has a few more variables, it is exactly like "A simple tutorial,"
which is in section I of the PHP Manual. Yes some manuals bury an
introductory lesson like that way down after all the installation and
configuration stuff, by PHP puts it right on top. Did you spent 12 hours
without finding the very first thing in the Manual? Do you even have the
Manual?

Is your problem with MySQL? If you have the data, can you enter it from the
mysql prompt (creating the table if you need to)? If you can't get the data
into your database from a mysql client prompt, you have no hope of getting
it in with PHP because you have to be able to write valid MySQL commands to
use PHP to send those commands to MySQL. Is the problem that you don't know
MySQL?

If you are past that, what is the problem? Can you connect to the MySQL
server? Can you connect to your MySQL database or not? Can you select a
table? Where is the problem? Which PHP mysql_* functions have you tried?
The manual has detailed examples of most of them. Look them up in the
function index at the bottom of the manual. In 12 hours you must have
found a few of them. What did you try? What went wrong?
I know I must be missing something since I've been to the w3
site, codewalkers, phpfreaks,php.n et(?), and many more.
If there is an easier way of doing this I would love to hear it.
People get paid for doing this stuff. Here are some hints if you hope
to get paid for it --- or at least hope to avoid having to pay someone
else to do it for you:

1. Use a text browser to get things to work. Lynx is one, there are
others. Don't worry about making pretty-pretty until you have valid markup
that works. This is a heck of a lot easier, especially if you tend to get
distracted by shiney objects in GUIs.

2. If you are stuck, divide the problem into little parts. In your case,
a way of dividing the parts would be a) make the form, b) get (actually
probably POST --- thats a little joke) the form data to a handler, c)
figure out how the handler will know the data is valid, d) connect to the
database, e) insert the data, and (until you are certain you have it right,
at least) f) figure out how to verify that what you did to the database was
what you intended to do.

3) When you are stuck, try things out by hand. Use PHP CLI to see if you
are getting the markup you think you are getting and pipe it through a
validator. Use the MySQL command-line client (conveniently called mysql on
many systems) to get your MySQL commands right --- because if you cannot
talk intelligently to MySQL from mysql, there is no hope you can talk
intelligently to MySQL through PHP.

4) When something works, save it --- save it some place you won't mess with
it. You can copy it and fill in the blanks to perform a task that is just a
little different. When you are copying something from your saved snippets
for the third or fourth time, it time to consider making a function of it.

5) When you are read to make pretty-pretty, use stylesheets as much as
possible. If you use CSS, learn to use context so you don't have to have
a class or id attribute on every little element.

If somene could point me in the right direction I could stop banging
my head and pulling my hair.
THANK YOU in advance for your advice.
--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
Countdown: 583 days to go.
An amazing thing about Christians: people who doubt being related to monkeys,
but are certain they belong to the same species as Paris Hilton or Karl Rove.
Jun 17 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1712
by: Dan | last post by:
A Newbie needs help! Is it possible, in PHP, to capture the resulting HTML of a submitted form returning from a server and incorporate that HTML into say a table, or some predefined layout? I am trying to incorporate the resulting HTML into a layout I have created in order to keep the look & feel of my site consistent, but the resulting...
7
3208
by: JDS | last post by:
Hi, all. I'd like to do the following, preferably *without* resorting to JavaScript: I have a long, dynamically-generated form questionnaire. Not all of the form fields are dynamically generated, though. I'd like to capture the NAME of every HTML form field element on the server, even if that element is submitted blank. The trouble is,...
4
2350
by: Drew Kellas | last post by:
Hi all! OK I admit it I'm new at java & java scripts. I have been asked to create a registration form for a club page on the web. I have been able to create my input boxes and am now trying to find a way to get the material entered in the boxes to populate an email to myself. Ideally, I want this to be done without the registrant having to...
7
20362
by: jerrygarciuh | last post by:
Hello, I have been playing with various Googled solutions for capturing the <Enter> key to suppress form submission. My first question is whether anyone has a script that works in all common browsers? The script bellow is IE only. It fails FF 1.0 and NN 7. Also, if I can trap the keypress I would like to use it to tab to the next...
1
4761
by: khawar | last post by:
my application is in asp.net using C# hi guys having a complicated problem i am using payflowlink to process CC payments I have to send a httppost to their servers. The problem is how do i do a post where i get these values like the amount from the database. eg of the post: <form method="post"...
10
5998
by: Andrew | last post by:
Hi, I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended"); I want to capture the OK and Cancel events of this alert messagebox. My code is in C#/ASP.NET. TIA. Andrew.
2
2271
by: jbigham | last post by:
Hello, I'd like to capture key events using javascript, but don't want to process such events when the user is typing into an input box or into a textarea. As an example, gmail has a feature where you can type "r" anywhere on the page while viewing a message and it will open a reply box, but if you type an "r" while entering text into a...
6
2273
by: gsherp | last post by:
Hi, Is there easy way of capturing innerHTML content when the user submits the form? I tried using a hidden input field which works, however...is there any other way of doing this without using hidden input field? Thanks, Dave
0
1302
by: colin | last post by:
Hi, I have an IDE style editor based on the WeifenLuo.WinFormsUI.Docking code, wich I must say seems realy good. Im trying to activate drop down menus and such from various special command key such as the windows apps key, and then do something like build up a context menu using reflection and picking items in the chain of windows and...
0
7527
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...
0
7459
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...
0
7726
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7485
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5377
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...
0
5097
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3488
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1953
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
1
1064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.