I'm fairly adept with XHTML and CSS but have yet to deal with PHP, forms and their input. I can make the form OK but here's where I'm stumped: Where does the data go? I'm designing a site for a nonprofit where people can sign up to help and to leave a message. That info is to be read by the client. How is that done? Where does the client go to read the info or where is the info sent for them to retrieve it?

I've been reading up on it, but still don't get it.

The form would look something like this:

< form action="xx.php" method="get" >
Name: < input type="text" name="Name" />
Address: < input type="text" name="Address" />
< input type="submit" />
< /form >

What goes in the "xx" part? And would the web page end in "php" and not "html" ?

Also, I still don't understand which is better to use, the "post" or "get" method.

I swear I've done research, but this doesn't seem to get answered anywhere. I'm truly stumped. I hope someone can help....it's the last remaining issue before the site goes live. Thanks!

3 answers


The xx.php would be your PHP script that would process the form data - either by putting it in an email or by storing it on some sort of database. The web page with the form in it doesn't have to be PHP, it can be HTML, but it doesn't really matter either way. Most forms use the POST method, as using the GET method to send data to the server has some restrictions and is considered bad practice (in technical terms a GET method should be both safe and idempotent, but don't worry about that too much - just use POST).

Once the form has been submitted your PHP script, xx.php or whatever you call it, will receive the data in the $_POST array. You then iterate through the array and do what you need with the data.

Answered over 9 years ago by Rob Crowther

http://www.kirupa.com/web/php_contact_form.htm is a nice tutorial to get you started... It doesn't cover everything, but will give you a good high level overview of what is involved for what you're trying to do.

Answered over 9 years ago by Dwayne Anderson
Nancy 0

Wow. Thank you both very much. Perfect --- just what I was looking for and it makes sense now. I appreciate your time and fast response. :-)

Answered over 9 years ago by Nancy