Sending Forms to Email

I have a website built in PHP and I would like to create my own forms that get sent to my email address. I am very new to PHP and html. I just searched the web on this topic but all the html/php codes/script that I found, didn't work. I would love to create my own forms instead of paying a service to do this for me. Does anyone know which code/script I should use to make this happen? Thanks.
 

LandisCreations

New Member
This is really dependent upon your hosting. A lot of web hosting companies make this fairly difficult. One thing that most require at this point is that the From address you're using to send mail from w/ the script is an email address that actually exists on your domain. For example, if you were trying to send email from [email protected] you would actually have to set this email address up for your domain.

If that doesn't work, try searching Google for something like: send email from form ::hosting company:: where you replace ::hosting company:: with the name of your web host. It's fairly difficult to diagnose since you rarely get error messages, but perhaps other people have had the same issue with your web host.

Best of luck!
~Nathan
 

smoovo

New Member
Try this

PHP:
<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail( "[email protected]", "Subject: $subject",
  $message, "From: $email" );
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='mailform.php'>
  Email: <input name='email' type='text' /><br />
  Subject: <input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
?>

</body>
</html>

By w3schools.com.
 

TheLivingDead

New Member
THANK YOU SMOOVO!!!! works great!
In the past I have simply relied on the cgi-scripts in my server's designated bin--

independence!!! :D
 
Top