Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

Contact Form Submission emailed

the mail() function

Moderators: macek, egami, gesf

Contact Form Submission emailed

Postby vjsinduja » Sun Dec 04, 2011 7:56 am

I want to have a contact form in my facebook page. I am using a free web hosting site to host my html files.
On facebook page, I create a tab where I can insert url so that, it display the html file from the free web hoster where I I have my files.

The problem I have is the mail function. I want the details submitted through that form to be emailed to me office email id(vsinduja@companyname.com).

I have WAMP installed in my computer. OS is Windows 7 Starter.

I have the html page with the form designed where there are 2 input fields
Code: Select all
<body>
<form id="form1" name="contact_form" method="post" action="mail.php">
   Name :
   <label>
     <input type="text" name="name" id="name" />
   </label>
  <br />
  <br />
  <br />
  Message :
  <label>
    <input type="text" name="message" id="message" />
  </label>
  <br />
  <br />
  <br />
  <label>
    <input type="submit" name="Submit" id="Submit" value="Submit" />
  </label>
  <label>
    <input type="reset" name="Reset" id="button" value="Reset" />
  </label>
</form>
</body>


The action page is "mail.php".
Please tell me what to do next

1. What are the attributes I need to have on the mail.php
2.What are the edit I should do on the php.ini file
3. Should hosting site should support mail()

Please guide me completely
vjsinduja
New php-forum User
New php-forum User
 
Posts: 1
Joined: Sun Dec 04, 2011 7:34 am

Re: Contact Form Submission emailed

Postby kc0pph » Sun Dec 04, 2011 8:24 am

By guide completely this is the most anyone can do without writing the code for you.

Gather the POST variables from your form.
$name = $_POST['name']
$message = $_POST['message']

Prepare the Email
$to = "vijuihdsa@companyname.com"
$subject = "Someone Likes you enough to send you a message"
$message = "You have a new message from". $name "<br /><br />". $message
$headers = 'From: Facebook@example.com' . "\r\n" .
'Reply-To: noreply@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();


mail($to, $subject, $message, $headers)

If you cant get it to work with that abstract then make a charitable donation to my NFL Sunday Beer fund and ill write your code.
kc0pph
New php-forum User
New php-forum User
 
Posts: 86
Joined: Sat Nov 26, 2011 8:39 am
Location: Pueblo, CO


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron