Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General

Notices


 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 07-08-2016, 04:44 AM   #2
Alizine
Registered User
 
Join Date: May 2016
Posts: 14
Basic PHP email() function code

Below is the code for the basic email function.


Code:
<?php
//if "email" variable is filled out, send email
  if (isset($_REQUEST['email']))  {
  
  //Email information
  $admin_email = "[email protected]";
  $email = $_REQUEST['email'];
  $subject = $_REQUEST['subject'];
  $comment = $_REQUEST['comment'];
  
  //send email
  mail($admin_email, "$subject", $comment, "From:" . $email);
  
  //Email response
  echo "Thank you for contacting us!";
  }
  
  //if "email" variable is not filled out, display the form
  else  {
?>

 <form method="post">
  Email: <input name="email" type="text" /><br />
  Subject: <input name="subject" type="text" /><br />
  Message:<br />
  <textarea name="comment" rows="15" cols="40"></textarea><br />
  <input type="submit" value="Submit" />
  </form>
  
<?php
  }
?>
Alizine is offline   Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to submit html code with php? eigeehte Programming General 2 05-26-2014 09:00 PM
Contact Form woodyciser Graphic Design 0 12-26-2013 01:24 AM
Contact form script problems ncjbhd HTML / DHTML 0 10-24-2011 08:42 PM
form to file script. php or html mjvndhsb PHP / mySQL 0 10-07-2011 08:55 PM


All times are GMT -7. The time now is 05:56 AM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.