Hello,
I am in need of assistance with some PHP coding. I'm not even a beginner, so please don't expect me to know ANYTHING.
Anyway, since HTML doesn't work for this, I am wondering how to create a form via PHP that emails the results to me.
I just want to be able to easily make text fields and text boxes, have the results emailed to a specific address, and the user taken to a success page.
Is it really so hard to ask?

I'll quack like a penguin, and sting like a flee.
eGaming Supply MMORPG Services - MMORPG Marketplace






Auriga posted this at 08:10 — 10th June 2005.
He has: 12 posts
Joined: Apr 2005
Clicky clicky!
That's a good one. If you get stuck just ask me.
EGS posted this at 11:00 — 10th June 2005.
They have: 168 posts
Joined: Jan 2005
:eek:
Thanks for the link!!!
Greg K posted this at 18:47 — 10th June 2005.
He has: 1,667 posts
Joined: Nov 2003
Another one that I use is PHPFormMail (http://www.boaddrink.com/) which started as a PHP version of the FormMail.pl program of yester-language...
Very simple to set up, you place the PHP file somewhere on your serer, adjust a few variables in there (very easy with the docs) and you are set to go.
You can then use it with mutlitple forms all over your site. In the form you set HIDDEN fields to command it. Note though, that people will be able to get your e-mail address from viewing your page source code.
A work around to this that I have used, is in the actual PHP file, at the beginning right below all the comments, add $_POST['recipient']="your@email.add"; to hard code in your e-mail address, then you don't have to include it on your form.
-Greg
[This space intentionally left blank]
Cool Geek Supplies: www.ThinkGeek.com
EGS posted this at 19:12 — 10th June 2005.
They have: 168 posts
Joined: Jan 2005
Would any of you be kind enough to tell me/give me the code to make an upload form?
PHP only please...I want to incorporate it into a form.
Awaiting your replies...Thanks!
I'll quack like a penguin, and sting like a flee.
eGaming Supply MMORPG Services - MMORPG Marketplace
timjpriebe posted this at 19:45 — 10th June 2005.
He has: 2,666 posts
Joined: Dec 2004
I've never done that in PHP, myself, but this looks like a good tutorial:
http://www.netspade.com/articles/php/uploading.xml
Plus they use the word "smattering."
Tim
http://www.tandswebdesign.com
EGS posted this at 23:24 — 10th June 2005.
They have: 168 posts
Joined: Jan 2005
This is getting me frustrated!
My email form won't work. Please help.
http://www.easysig.info/contact.php
Contact.php File:
<?php$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
Use this form to contact EasySig, or to request EasySig's support of an email provider.
Contact Type:
General Contact
Email Provider Submission
Name:
Email:
Comments: Comments, Suggestions, Cries for Help
[?] Upload @yoursite.com: Please Click Here To Upload
Please rate EasySig if you have the time: Excellent Good Average Bad
Contacted.php File:
Thanks, your message has been sent.
<?php$myemail = "editedout@nospam.com";
if((!
$visitormail == "") && (!strstr($visitormail,"@") || !strstr($visitormail,"."))){
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$tellem = "<h2>Feedback was NOT submitted</h2>\n";
}
if(empty(
$Name) || empty($Email) || empty($Comments)) {echo "<h2>Use Back - fill in all fields</h2>\n";
}
echo
$tellem;if (
$emailvalidation == "y") {$req1 = "Email format Validation \n" ;
}
if (
$fieldvalidation == "y") {$req2 = "Required Form Field Validation \n";
}
if ($htmlcontrol == "y") {
$req3 = "More intergratd HTML (in form) \n";
}
if ($phpform == "y") {
$req4 = "Improved PHP form script generator \n";
}
if ($htmlform == "y") {
$req5 = "A complete HTML form generator \n";
}
$req = $req1 . $req2 . $req3 . $req4 . $req5; $todayis = date("l, F j, Y, g:i a") ; $attn = $Name;
$subject = $attn; $feedback = stripcslashes($Comments); $message = " $todayis [EST] \n
Attention: $attn (Rating:$rating) \n
From: $Name ($Email)\n
Requested:
$req \n
Feedback: $Comments \n
Additional Info : IP = $ip \n
Browser = $httpagent \n
Referral = $httpref
"; $from = "From: $Email\r\n";
if (
$myemail != "editedout@nospam.com")mail($myemail, $subject, $message, $from); $screenout = str_replace("\n", "<br/>", $message);
?>
<?phpecho $screenout
?>
Try to test this out at http://www.easysig.info/contact.php ... as you can see it doesn't work!
HELP!
I'll quack like a penguin, and sting like a flee.
eGaming Supply MMORPG Services - MMORPG Marketplace
EGS posted this at 02:46 — 11th June 2005.
They have: 168 posts
Joined: Jan 2005
Help.
Greg K posted this at 01:31 — 12th June 2005.
He has: 1,667 posts
Joined: Nov 2003
If no one can help you before then, I'll be able to look at it tomorrow or monday morning.
-Greg
EGS posted this at 02:56 — 12th June 2005.
They have: 168 posts
Joined: Jan 2005
I feel so...neglected.
Abhishek Reddy posted this at 03:17 — 12th June 2005.
He has: 3,303 posts
Joined: Jul 2001
Page doesn't load. I tried yesterday and figured it was a random error. Still nothing.
bja888 posted this at 04:09 — 12th June 2005.
He has: 902 posts
Joined: Feb 2004
Dont take it personally. The people on this fourm are only helpfull 3 of 5 posts. I cannot help because I try to avoid php. I'll write you a asp or asp.net script though.
Sites hub
Flash Portfolio
OptimalSource.biz
baldrick posted this at 12:28 — 12th June 2005.
He has: 388 posts
Joined: Apr 2005
Put this in a file called mail.php
and remember to changethe $to variable to show your email
<!-- you can insert all the html you want around the php -->
<?
$name=$_POST['name'];
$email=$_POST['email'];
$comments=$_POST['comments'];
$to="your e-mail here";
$subject="comments from your website";
$message="$name just sent you an email from the form on your website. They said:\n$comments\n\nTheir e-mail address was: $email";
if(mail($to," $subject",$message,"From: $email\n ")) {
echo "Thank you $name for your comments.";
} else {
echo "There was a problem sending the comments.<br> Please check that you filled in the form correctly.";
}
?>
<!-- you can put html here too -->
'
and then this is the form for you to put anywhere you want
<form action="mail.php" method="post">
Your Name: <input type="text" name="name">
your E-mail: <input type="text" name = "email"><br>
Comments<br>
<textarea name="comments"></textarea><br><br>
<input type="submit" value="Send">
</form>
'
If you have any questions on adapting this script. please post them here I and im sure evreyone else will be glad to help.
EGS posted this at 15:52 — 12th June 2005.
They have: 168 posts
Joined: Jan 2005
Ok I went with vibin's method, but it's still not working. Here is the code for each page:
mail.php
<?
$name=$_POST['name'];
$email=$_POST['email'];
$comments=$_POST['comments'];
$rating=$_POST['rating'];
$to="admin@easysig.info";
$subject="EasySig Contact Form";
$message="$name just sent you an email from the form on your website. They said:\n$comments\n\nTheir e-mail address was: $email"/n/n$name has rated EasySig with "$rating";
if(mail($to," $subject",$message,"From: $email\n ")) {
echo "Thank you $name for your comments.";
} else {
echo "There was a problem sending the comments. Please check that you filled in the form correctly.";
}
?>
contact.php
Use this form to contact EasySig, or to request the support of an email provider.
Name:
Email:
Comments:
Please rate EasySig if you have the time: Excellent Good Average Bad
[?] Upload @yoursite.com: Please Click Here To Upload
I'll quack like a penguin, and sting like a flee.
eGaming Supply MMORPG Services - MMORPG Marketplace
baldrick posted this at 17:16 — 12th June 2005.
He has: 388 posts
Joined: Apr 2005
take the quotes from around $rating in the $message variable.
EGS posted this at 20:49 — 12th June 2005.
They have: 168 posts
Joined: Jan 2005
Hi, it still doesn't work.
Here is the file coding again:
<?
$name=$_POST['name'];
$email=$_POST['email'];
$comments=$_POST['comments'];
$rating=$_POST['rating'];
$to="admin@easysig.info";
$subject="EasySig Contact Form";
$message="$name just sent you an email from the form on your website. They said:\n$comments\n\nTheir e-mail address was: $email"/n/n$name has rated EasySig with a rating of $rating;
if(mail($to," $subject",$message,"From: $email\n ")) {
echo "Thank you $name for your comments.";
} else {
echo "There was a problem sending the comments. Please check that you filled in the form correctly.";
}
?>
After an $email variable, there's a " mark for some reason. Please help me..
I don't know what the problem is..
I'll quack like a penguin, and sting like a flee.
eGaming Supply MMORPG Services - MMORPG Marketplace
baldrick posted this at 13:00 — 13th June 2005.
He has: 388 posts
Joined: Apr 2005
ok i fixed it and tested it is should now work
here it is:
<?
$name=$_POST['name'];
$email=$_POST['email'];
$comments=$_POST['comments'];
$rating=$_POST['rating'];
$to="admin@easysig.info";
$subject="EasySig Contact Form";
$message="$name just sent you an email from the form on your website. They said:\n$comments\n\nTheir e-mail address was: $email $name\n has rated EasySig with a rating of $rating";
if(mail($to," $subject",$message,"From: $email\n ")) {
echo "Thank you $name for your comments.";
} else {
echo "There was a problem sending the comments. Please check that you filled in the form correctly.";
}
?>
EGS posted this at 18:58 — 13th June 2005.
They have: 168 posts
Joined: Jan 2005
Still does not work.
baldrick posted this at 19:01 — 13th June 2005.
He has: 388 posts
Joined: Apr 2005
what does it say when you try it
EGS posted this at 19:08 — 13th June 2005.
They have: 168 posts
Joined: Jan 2005
You go ahead and try it out yourself at http://www.easysig.info/contact.php
For some reason, once you submit it...you are redirected to the main page (index.php). -.-
H-E-L-P.
I'll quack like a penguin, and sting like a flee.
eGaming Supply MMORPG Services - MMORPG Marketplace
baldrick posted this at 19:11 — 13th June 2005.
He has: 388 posts
Joined: Apr 2005
The action of your form is index.php thats why its ment to be mail.php
EGS posted this at 19:15 — 13th June 2005.
They have: 168 posts
Joined: Jan 2005
...it is post mail.php command.
baldrick posted this at 19:18 — 13th June 2005.
He has: 388 posts
Joined: Apr 2005
sorry i was lookin at the wrong form.
I have absolutely no idia why that is happening
baldrick posted this at 19:24 — 13th June 2005.
He has: 388 posts
Joined: Apr 2005
try putting the php below the form and using
<?phpecho $_SERVER['PHP_SELF'];
?>
as the action
EGS posted this at 01:19 — 14th June 2005.
They have: 168 posts
Joined: Jan 2005
Alright..I'm about to slap somebody.
Someone: Please HELP me!
chrishirst posted this at 05:56 — 14th June 2005.
He has: 379 posts
Joined: Apr 2005
you have two tags and only one the first has action="index.php"> that will be the one that takes precedence.
Chris
Indifference will be the downfall of mankind, but who cares?
Venue Capacity Monitoring
Code Samples
EGS posted this at 12:36 — 14th June 2005.
They have: 168 posts
Joined: Jan 2005
Success!
Thank you everyone!
I'll quack like a penguin, and sting like a flee.
eGaming Supply MMORPG Services - MMORPG Marketplace
baldrick posted this at 12:58 — 14th June 2005.
He has: 388 posts
Joined: Apr 2005
wow it was that simple i didn't notice it well done chrishirst