Jump to content

PHP Form Help


jurass1c

Recommended Posts

Hey i have been busting for some help.

I was looking for a PHP script. Its like a emailer script, basically i want to have a script where someone comes along fills in a feilds then submits it. I then i whould like the script to send a copy of what has been filled out in the fields to my email then i would like the script to send a seperate email to the person who subbmitted the form.

so something basically like

Name
Email
Comments

Then as i said a email sent to me on what they filled out, then a seperate emial sent to the person who filled this out.
I am a little familar with PHP I know abit about it but just dont know the syntax to make this work its really got me stunned how to do this ? any ideas or even scripts would be gratefull. The person who can help me do this i will pay through paypal a price will be discussed.

Thanks again if you guys wish to talk to me MSN me [email protected]
Link to comment
https://forums.phpfreaks.com/topic/3674-php-form-help/
Share on other sites

welcome to the forums! hope you find lots of great help here.

if you simply want 2 emails sent out, then, do something like this:
[code]
<?php
if (isset($_POST['submit'])) {
  // send first email:
  $to = '[email protected]';
  $from = $_POST['email'];
  $subject = "Comment from $_POST[name]\n";
  $message = "You have received a message from your contact form:\n\n" .
      "Name: $_POST[name]\n\n" .
      "Comments:\n$_POST[comment]\n";
  mail($to, $subject, $message, "From: $from\r\n Reply-To: $from\r\n");

  // send confirmation email
  $to = $_POST['email'];
  $from = '[email protected]';
  $subject = "Thanks for your comments";
  $message = "Thank you for taking the time to send me your comments!";
  mail($to, $subject, $message, "From: $from\r\n Reply-To: $from\r\n");
}
?>

<form name='comments' method='post' action=''>
Name: <input type='text' name='name' /><br />
Email: <input type='text' name='email' /><br />
Comment: <textarea name='comment' cols='60' rows='12'></textarea>
</form>
[/code]

of course, for the final version of this, you'd want to run some validation to make sure they enter a valid email address, etc.

hope this helps
Link to comment
https://forums.phpfreaks.com/topic/3674-php-form-help/#findComment-12732
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.