Forums

PHP

This topic is locked

forms forms forms....ahhhh

Posted 16 Dec 2002 05:39:49
1
has voted
16 Dec 2002 05:39:49 E Cunningham posted:
hello i'm new to dreamweaver mx and i have created a form with check boxes and the lot. I have been asked to make it so that when someone clicks on the submit button, all the data they filled in is sent to my email address.
can someone puulleeaaaassseee help me?

Replies

Replied 16 Dec 2002 06:05:23
16 Dec 2002 06:05:23 Cory Marchasin replied:
Ok,...
Since no-one here has helped you do this, I'll give it a go. (Although I am sure there are more talented/qualified coders here, I think I can explain this well)

you will need to point your form to a script to send the mail off. Lets call it "sendMail.php". here is the general format:

<?
mail( " ", "subject", \n\n "Message:\n$message
\n\n From:$email \n\n PhoneNumber:$phone", "From: $email";
?>

/n is a line break, so you can format the results. You dont just want a gobelygook of info in your in-box.

you will also notice the different sections seperated by "", and a comma(,). Important

so the basic layout is like this:

<?php
mail("address to send to","subject","body of message","from";
?>

you could make those "checkboxes you need with a "name" like LikesBaths, and make the checked value = "yes" . then in the message part of the script you could have it set up like this:

"likes Baths? = $LikesBaths /n
Want's a punch in the face? = $punchFace /n
$name /n
$email /n ",

or whatever your form field names are.

Thats pretty much it. Does not get much easier,...UNLESS...
your server is not set-up for php to send emails like this (usually is though),.. in which case you might need to talk to your server admin if you cant get it to work properly.

Need more help?? get a book.

Reply to this topic