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 jurasiprize@hotmail.com
Link to comment
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 = 'you@yourdomain.com';
  $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 = 'you@yourdomain.com';
  $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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.