Jump to content

Recommended Posts

Hi everyone,

I am such a newbie to php... dont know how to write codes using php as m a .net person

but in a very urgent need to make an email form using php

Please help me.

I just want to send email on submit button click event

the email form will include name, phone number, email adress, and a word document... and these fields should be mandatory and phone number , email text boxes should be validated as well.

Please help me asap.........

Thanx in advance..

Link to comment
https://forums.phpfreaks.com/topic/243457-sending-email-using-php/
Share on other sites

1---create an html form with ur required fields and then post them using thte submit button on the same page with action="" or to some other page where you want to have thtat sending option...

 

2-- now get the values from the for using the method u have used in form that is get or post..

 

 

3-- now the search for the mail function of php you will find it easily.. its having portions like subject,message,header where you can adjust ur values.

 

4-- but remeber one thing its not going to deliver ur message from local site unless you have files on the server.

 

5-- see this

 

 

 

<?php

 

 

 

// Your email address

 

$email = "[email protected]";

 

 

 

// The subject

 

$subject = "Enter your subject here";

 

 

 

// The message

 

$message = "Enter your message here";

 

 

 

mail($email, $subject, $message, "From: $email");

 

 

 

echo "The email has been sent.";

 

 

 

?>

 

hi,

i tried this code....

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Contact Us</title>

</head>

 

<body>

<?php

 

 

$formname= $_POST["name"];

 

$formaddress= $_POST["address"];

 

  $formemail= $_POST["email"];

    $touser= $_POST["email"];

$tosubject="Enquiry - Thank You";

$tobody="Dear $_POST[name],<br>

<br>

<br>

 

 

 

 

Thank you for contacting us. We have received your enquiry and will get back to you very soon.<br>

<br>

<br>

 

Best Regards<br>

<br>

 

 

Support Team<br>

<br>

 

 

http://hrpn.co ";

 

 

  $formcontactno= $_POST["contactno"];

 

    $formdiscription= $_POST["discription"];

 

$to="[email protected]";

$subject="Enquiry  ";

$body="<table width='45%' border='0' cellspacing='0' cellpadding='0'>

  <tr>

    <td width='41%'>Name</td>

    <td width='59%'>$formname</td>

  </tr>

  <tr>

    <td>Address</td>

    <td>$formaddress</td>

  </tr>

  <tr>

    <td>E-mail id</td>

    <td>$formemail</td>

  </tr>

  <tr>

    <td>Contact</td>

    <td>$formcontactno</td>

  </tr>

  <tr>

    <td>Description</td>

    <td>$formdiscription</td>

  </tr>

</table>";

$headers = "From :".$_POST["email"] ."\r\n";

 

$headers.="Mime-version: 1.0"."\r\n" . 

 

  "Content-type: text/html; charset=iso-8859-1"; 

 

 

$toheaders = "From: HRPN <[email protected]> \r\n";

 

$toheaders.="Mime-version: 1.0"."\r\n" . 

 

  "Content-type: text/html; charset=iso-8859-1";

 

 

mail($to,$subject,$body,$headers);

mail($touser,$tosubject,$tobody,$toheaders);

 

?>

<script type="text/javascript">

window.location="contact.html";

</script>

</body>

</html>

 

 

but i am not getting any mail... plz help....

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.