...

View Full Version : Feedback forms



Vantage
04-19-2004, 03:36 PM
Hi. New poster here. Glad I found this place, I'm sure it will prove to be invaluable :D

I'm trying to create a feedback form. I have made the form using dreamweaver and my hosting company has provided me with the following code for the php file:

<?
mail( "yourname@yourdomain.com", "Feedback Form Results",
$message, "From: $email", "-fuser@userdomain.com" );
header( "Location: http://www.yourdomain.com/thankyou.html" );
?>


I've changed all the field names to correspond. It doesn't work properly. I recieve the email but with none of the details (email address, message etc). I've tried tinkering with it but to no avail. It's really infuriating actually :(!

The html code is here btw:

<FORM method=post action="sendmail.php">
Email: <INPUT name="email" type="text"><br>
Message:<br>
<TEXTAREA name="message">
</textarea><br>
<input type=submit>
</FORM>

Any help would be greatly appreciated. Thanks everyone.

Nightfire
04-19-2004, 05:36 PM
Your host needs to update their code they're handing out.


<?php
mail("yourname@yourdomain.com", "Feedback Form Results",
$_POST['message'], "From: ". $_POST['email'] ." <". $_POST['email'].">");
header("Location: http://www.yourdomain.com/thankyou.html");
?>

Vantage
04-19-2004, 06:50 PM
Thanks for your reply.

I copies and pasted your code, changed the email address etc but I still get the same result. An email arrives but no detail (email address, message etc).

The from field says "INVALID_ADDRESS@.SYNTAX-ERROR", the subject field says "Feedback Form Results" (Which is correct btw).

The email arrives but with no message in it.

Any more help would be appreciated.

Thanks.

thunderbox
04-20-2004, 12:10 AM
i have used that script on a website, it works 4 me. what email are u sending the message 2?

Vantage
04-21-2004, 03:51 PM
It's working now; FINALLY :thumbsup:

Thanks for your replies. I was maybe thinking of having another couple of fields. "Phone number", "Address" etc and maybe a couple of check boxes. Could anyone provide me any help on this?

Thanks again :D

Vantage
04-22-2004, 11:23 AM
I would really like to put a "name" and "phone" field in front of the message field but I'm having trouble.

Here is my code: (PHP)

<?php
mail("email@mydomain.co.uk", "Feedback Form Results",
$_POST['message'], "From: ". $_POST['email'] ." <". $_POST['email'].">");
header("Location: http://www.mydomain.co.uk");
?>


(HTML)
<FORM method=post action="sendmail.php">
Email: <INPUT name="email" type="text"><br>
Message:<br>
<TEXTAREA name="message">
</textarea><br>
<input type=submit>
</FORM>

I want to add form fields called "name" and "phone" to my form and have them emailed to my address.

Do i have to add "name" and "phone" in $_POST['message'], for example?

Thanks,

Charlie.

raf
04-22-2004, 12:13 PM
Edited code


<?php
$mailbody = 'Name : ' . $_POST['txt_name'] . '. Phone : ' . $_POST['txt_name'] .'. Message : ' . $_POST['message'] ;
mail("email@mydomain.co.uk", "Feedback Form Results",
$mailbody, "From: ". $_POST['email'] ." <". $_POST['email'].">");
header("Location: http://www.mydomain.co.uk");
?>


Edited form
<FORM method=post action="sendmail.php">
Name:<input name="txt_name" id="txt_name" /><br />
Phone:<input name="txt_phone" id="txt_phone" /><br />
Email: <INPUT name="email" type="text"><br>
Message:<br>
<TEXTAREA name="message">
</textarea><br>
<input type=submit>
</FORM>

Vantage
04-22-2004, 12:42 PM
Excellent. Thanks, mate.

The email looks like this:

Name: xxxxxxxx Phone: xxxxxxxxx Message: xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Is there any way of changing the formatting of the emailbody so that it looks like this:

Name: xxxxxxxxxxxx

Phone: xxxxxxxxxxxx

Message: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxx

Again, thanks for your help.

Charlie.

Vantage
04-22-2004, 12:47 PM
Figured the formatting out now.

Thanks

Charlie.

bcarl314
04-22-2004, 02:27 PM
I just did a lecture on emails for a class I'm teaching. Perhaps this link will help...

http://www.aphion.com/class/class9/sendmail.html

Vantage
04-23-2004, 12:56 PM
Thanks. I'll take a look.

Charlie.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum