html/php forms |
html/php forms |
jason95 |
Aug 27 2010, 01:41 PM
Post
#1
|
Newbie Group: Members Posts: 14 Joined: 27-August 10 Member No.: 12,603 |
Hi there I have a problem that im hoping to get help with.Recently I created a html document that also contains a contact form.But when the form is filled out and sent to my email addresss,it only contains the form fields such as Name:
Address: Email: and coments: The data that was filled in does not arrive!I copied my html form onto the correct php script and am totaly stuck,is the problem with the html code? any help would be gratefull! |
Darin McGrew |
Aug 27 2010, 06:37 PM
Post
#2
|
WDG Member Group: Root Admin Posts: 8,365 Joined: 4-August 06 From: Mountain View, CA Member No.: 3 |
My guess is that the PHP program is emailing the data it was programmed/configured to email. To get it to email more data, you need to program or reconfigure it. I can't say more without knowing which PHP program you're using. What does the documentation for your PHP program say?
|
wgabrie |
Aug 27 2010, 10:01 PM
Post
#3
|
Advanced Member Group: Members Posts: 148 Joined: 11-July 10 Member No.: 12,279 |
It seems to me that the values from the form fields aren't making the move into the php script variables and onto the email message.
The fix might be as simple as reading up on the mail function: PHP: mail - Manual. However, a lot depends on whether this php script is your own and you are trying to get it to work or if it is someone else's work and it just doesn't function correctly. Like Darin McGrew was saying, if you are using someone else's php script it would be crazy for the creator to expect you to fix a broken script without giving you directions. It could be madly complicated. |
jason95 |
Aug 28 2010, 06:34 PM
Post
#4
|
Newbie Group: Members Posts: 14 Joined: 27-August 10 Member No.: 12,603 |
It seems to me that the values from the form fields aren't making the move into the php script variables and onto the email message. The fix might be as simple as reading up on the mail function: PHP: mail - Manual. However, a lot depends on whether this php script is your own and you are trying to get it to work or if it is someone else's work and it just doesn't function correctly. Like Darin McGrew was saying, if you are using someone else's php script it would be crazy for the creator to expect you to fix a broken script without giving you directions. It could be madly complicated. 'wgabrie' date='aug 27 2010,10.01pm thanks for the replies guys,I have the php code here, so hopefully its a simple programing error that i made myself! <?php /* Subject and Email Variable */ $emailSubject ='contactform.php'; $webMaster ='emailaddress'; /* Gathering Data Variables */ $firstnameField = $_POST['firstname']; $lastnameField = $_POST['lastname']; $addressField = $_POST['address']; $body = <<<EOD <br><hr><br> Firstname: $firstname <br> Lastname: $lastname <br> Address: $address <br> EOD; $headers = "from: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers) ; /* Results rendered as HTML */ $theResults = <<<EOD Then i pasted in my html code and at the very bottom added EOD; echo "$theResults"; ?> Any ideas? Its all new to me,so have followed tutorials along the way! |
Brian Chandler |
Aug 28 2010, 10:11 PM
Post
#5
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
QUOTE Any ideas? We need to see the *whole* php file. And preferably the URL of the test page. For a start: $webMaster ='emailaddress'; It looks as though 'emailaddress' should be replaced by an email address. If you don't want to publish some things (such as database passwords!), use a convention such as ***PASSWORD***, and tell us that you are using it. |
wgabrie |
Sep 3 2010, 07:26 PM
Post
#6
|
Advanced Member Group: Members Posts: 148 Joined: 11-July 10 Member No.: 12,279 |
I don't know how important this is, but w3school's php mail example uses $_REQUEST in gathering the data variables while you are using $_POST.
|
Brian Chandler |
Sep 3 2010, 10:30 PM
Post
#7
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
I don't know how important this is, but w3school's php mail example uses $_REQUEST in gathering the data variables while you are using $_POST. If the form uses POST, then the best way is to use the $_POST variables as the OP has. $_REQUEST supplies all forms of input: GET, POST, and cookies. |
jason95 |
Sep 6 2010, 01:26 PM
Post
#8
|
Newbie Group: Members Posts: 14 Joined: 27-August 10 Member No.: 12,603 |
I don't know how important this is, but w3school's php mail example uses $_REQUEST in gathering the data variables while you are using $_POST. If the form uses POST, then the best way is to use the $_POST variables as the OP has. $_REQUEST supplies all forms of input: GET, POST, and cookies. Thanks for the replies,all of the php script above with the $_POST variables is working correctly, I have gone over every inch of the html code for the contact form and the section with the input type = ****** had no inverted comas and the < brackett was in the wrong place,which I should have spotted. It turned out to be a simple beginners mistake! Back to the basics I think! |
Lo-Fi Version | Time is now: 21st May 2024 - 04:56 AM |