Php Form Processing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Pwnious
Forum Newbie
Posts: 5
Joined: Mon Apr 03, 2006 3:23 pm

Php Form Processing

Post by Pwnious »

I have searched the internet for this. I want to create a form processor with processes the form to a page which only certain people can access. I got everything down but the form processing. Does anyone have this code or can you lead me to the right direction?

Thanks.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

What's your form look like? What is your existing code? What is it exactly you are trying to do when you say "process"?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Php Form Processing

Post by Christopher »

Pwnious wrote:I have searched the internet for this.
I just Googled "PHP form processing" and there are many results. Form processing is a fairly large subject. Maybe post you code.
(#10850)
Pwnious
Forum Newbie
Posts: 5
Joined: Mon Apr 03, 2006 3:23 pm

Re: Php Form Processing

Post by Pwnious »

arborint wrote:
Pwnious wrote:I have searched the internet for this.
I just Googled "PHP form processing" and there are many results. Form processing is a fairly large subject. Maybe post you code.
Yeah I know, but it is not the kind of form processing I want. I need to make one which processes the form to post on a webpage.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Php Form Processing

Post by Christopher »

Pwnious wrote:Yeah I know, but it is not the kind of form processing I want. I need to make one which processes the form to post on a webpage.
I am assuming from that you mean that you want to create a HTML form and have it post its values to a PHP script to validate the form. Is that the kind of form processing you want? Again, post some HTML or PHP code and we can help.
(#10850)
Pwnious
Forum Newbie
Posts: 5
Joined: Mon Apr 03, 2006 3:23 pm

Post by Pwnious »

Yes somthing like that, I can work on it after I get some info on that. click here for form and the only php code I got so far for this is

Code: Select all

<?php echo $_POST['insert name']; ?>
khendar
Forum Newbie
Posts: 6
Joined: Mon Apr 03, 2006 7:15 pm

Post by khendar »

You'll need to store the information from the form somewhere so the webpage can retrieve or display it. You need to decide whether you want to use a flat file or a database to do this. Both are pretty much the same amount of coding, but the database will require some setup.

If you know this already, then you need to explain what kind of processing you are talking about ? Do you mean validation/verification ? Error checking ? Calculations ?

More information will help.
Pwnious
Forum Newbie
Posts: 5
Joined: Mon Apr 03, 2006 3:23 pm

Post by Pwnious »

Flat file? Any info on that? I am currently useing the database to store the inputs, Not done yet. the form processing suppose to display the input on a webpage ,but i guess validation/verification.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Flat file = plain old text, csv or dbm file that resides on the filesystem, usually called the "poor man's database." If you've got a database then stick with it.

Hmm... it's a big subject. Let's try the socratic method. Once the data is sent to you, what do you think you'd do with it first?
khendar
Forum Newbie
Posts: 6
Joined: Mon Apr 03, 2006 7:15 pm

Post by khendar »

Flat file just means storing the data in a text file. If you are using a database then you dont need this.

You can display the form data in a webpage once, but if you want it to stay there you have to store it in your database. To display the data submitted from the form:

Code: Select all

$field_1 = $_POST['field_1'];
$field_2 = $_POST['field_2'];
...
etc

echo "$field_1<br>$field_2<br>...etc";
Where field_1 etc are the names of the <input> fields in the form. This will only display the data as a once off. As soon as the user navigates away from this page it will disappear.

What sort of validation are you talking about ? What sort of data is the form going to submit ?
Pwnious
Forum Newbie
Posts: 5
Joined: Mon Apr 03, 2006 3:23 pm

Post by Pwnious »

Ok I'll stick with the database.
Post Reply