Dynadot โ€” .com Registration $8.99

Script for form to email??

Spaceship Spaceship
Watch

JH

Established Member
Impact
5
hi,

dose anyone know a script to place on my site that will send form information to my email???
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
check hotscripts.com, sourceforge.net, freshmeat.net
 
0
•••
PHP:
<? 

mail ("email here", "$subject","$message");

?>
 
0
•••
0
•••
cheers i will have a look
 
0
•••
I can program you one if you wish.

CyberSpatium said:
check hotscripts.com, sourceforge.net, freshmeat.net

That is correct. These sites are preferable!
 
0
•••
i say hotscripts.com is your best choice i got mines from there last time
 
0
•••
its really easy...i can make 1 for u if u want
 
0
•••
Come up with one on the spot :P

PHP:
<?php

echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>
Name:
<br>
<input type='text' name='name'>
<br>
E-mail:
<br>
<input type='text' name='email'>
<br>
Message:
<br>
<textarea name='message' rows='10' cols='40'></textarea>
<br>
<br>
<input type='submit' name='submit' value='Submit'>
</form>";

if($_POST['submit'])
{
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  
  if(empty($name) || empty($email) || empty($message))
  {
    echo "All fields required. Please enter all information and try again.";
  }
  else
  {
    $name = stripslashes($name);
    $message = trim(stripslashes($message));
    $message = wordwrap($message, 70, "<br>\n");

    $recip = "[email protected]";
    $subject = "Message from yoursite.com";

    $headers = 'From: '.$email.'';

    mail("$recip", "$subject","

    Name:
    $name

    Email:
    $email

    Message:
    $message

  ", $headers);
  
  if(!mail)
  {
    echo "Seems to have been a problem, your message could not be sent, please try again later."
  }
  else
  {
    echo "Thank you, ".$name." for contacting us.";
  }
}
?>

:) It can be customized as well. If you require more data etc, should be easy to add the fields, etc...

-Eric
 
0
•••
Eric, if I just edited the email address and saved that code as contact.php, should it work as is? Or do I need to do something more? I tried it as is and get a 'Parse error line 57'.
 
0
•••
Gene said:
Eric, if I just edited the email address and saved that code as contact.php, should it work as is? Or do I need to do something more? I tried it as is and get a 'Parse error line 57'.
Yes, should work as is, and for the parse error (stupid me) missing a ; on this line:

PHP:
echo "Seems to have been a problem, your message could not be sent, please try again later."

And it should be:

PHP:
echo "Seems to have been a problem, your message could not be sent, please try again later.";
 
0
•••
Hmm, now getting parse error on line 63 (last line).
 
0
•••
Grrr, I need some sleep:

PHP:
<?php

echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>
Name:
<br>
<input type='text' name='name'>
<br>
E-mail:
<br>
<input type='text' name='email'>
<br>
Message:
<br>
<textarea name='message' rows='10' cols='40'></textarea>
<br>
<br>
<input type='submit' name='submit' value='Submit'>
</form>";

if($_POST['submit'])
{
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  
  if(empty($name) || empty($email) || empty($message))
  {
    echo "All fields required. Please enter all information and try again.";
  }
  else
  {
    $name = stripslashes($name);
    $message = trim(stripslashes($message));
    $message = wordwrap($message, 70, "<br>\n");

    $recip = "[email protected]";
    $subject = "Message from yoursite.com";

    $headers = 'From: '.$email.'';

    mail("$recip", "$subject","

    Name:
    $name

    Email:
    $email

    Message:
    $message

  ", $headers);
  
  if(!mail)
  {
    echo "Seems to have been a problem, your message could not be sent, please try again later.";
  }
  else
  {
    echo "Thank you, ".$name." for contacting us.";
  }
}
}
?>
 
0
•••
BINGO! Works like a charm. Thank you!
 
0
•••
Gene said:
BINGO! Works like a charm. Thank you!
No problem :) And like I said, it can easily be customized for more fields and what not. If you need any added (anyone) let me know and I'll add them. :tu:
 
0
•••
Unstoppable Domains
Domain Recover
DomainEasy โ€” Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back