Jump to content


Photo

PHP Form Help


  • Please log in to reply
2 replies to this topic

#1 jurass1c

jurass1c
  • Members
  • PipPipPip
  • Advanced Member
  • 57 posts

Posted 27 February 2006 - 02:39 PM

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

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 27 February 2006 - 02:46 PM

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:
<?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>

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
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 jurass1c

jurass1c
  • Members
  • PipPipPip
  • Advanced Member
  • 57 posts

Posted 27 February 2006 - 02:49 PM

Thanks allot i still do need some help and as i said, i will pay you through paypal. If you could add my msn it would be great man.

Knowledge is time time is money.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users