Jump to content

Email my form help.


Tim Garrett

Recommended Posts

Hello fellow coders

 

This seems a perfect place to hopefully get some help.  i have been trying to figure this out for 4 hours now and still going!im trying to  work out when a user pushes my submit button it email out the info that has been inputted i to the form from a user { i v been over so many different tutorials. just cant seem to get it to work!!! please please please can someone have a quick look at my code and see where im going wrong.

 

about an hour ago i did manage to get it to email to my  address but no info that was inputted into form got emailed to me.

 

really appreciate this in advance.

<?php
$to = "admin@qualityhub.co.nz"; //
$subject = "Incident report";  //
$firstname = $_POST['firstname'] ;
$lastname = $_POST['lastname'] ;
$jobtitle = $_POST['jobtitle'] ;
$email = $_POST['email'] ;
$mobile = $_POST['mobile'] ;
$date= $_POST['date'] ;
$time = $_POST['time'] ;
$describetheincident= $_POST['describetheincident'] ;
$describeimmediateactions= $_POST['describeimmediateactions'] ;
$describeanycontributingfactors= $_POST[describeanycontributingfactors'] ;
$message = "reportersfirstname: $firstname <br />reporterslastname: $lastname <br />jobtitle: $jobtitle <br />email: $email <br />mobile: $mobile  <br />date: $date <br />Time: $time <br />date: $date <br />time: $time <br />DescribetheIncident: $DescribetheIncident <br />DescribeImmediateActions:$DescribeImmediateActions <br />DescribeAnyContributingFactors: $DescribeAnyContributingFactors <br />
$headers = "From: $email"; //header that states the email address of user- leave this
$sent = mail($to, $subject, $message, $headers) ; //send the whole thing and report to code below
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />
<link href="pics/homescreen.png" rel="apple-touch-icon" />
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="javascript/functions.js" type="text/javascript"></script>
<title>Submission Status
</title>
</head>

<body>

<div id="topbar">
   <div id="title">
   Thank you!! </div>
      <div id="leftnav">
      <a href="index.html">Back</a></div>
   </div>
   <div id="content">
      <ul class="pageitem">
         <li class="textbox">
           <p><div align="center"><?php if($sent)
{print "Your mail was sent successfully";
}
else
{print "We encountered an error sending your mail";

}?></p>     
</div>
         </li>
      </ul>
     </div>
     </body>
</html>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="index,follow" name="robots" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="pics/homescreen.gif" rel="apple-touch-icon" />
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />
<link href="css/style.css" rel="stylesheet" media="screen" type="text/css" />
<script src="javascript/functions.js" type="text/javascript"></script>
<title>Auckland distric health board</title>
<meta content="iPod,iPhone,Webkit,iWebkit,Website,Create,mobile,Tutorial,free" name="keywords" />
<meta content="now completly styles thanks to css these form elements are lighter and easier to use than ever before." name="description" />
</head>

<body>

<div id="topbar">
<div id="leftnav">
	 </a><a href="index.html">ADHB HOME</a></div>

</div>

</div>


<div id="content">

<form>

<ul class="pageitem">
	<li class="textbox"><span class="header">Incident infomation</span>Please fill in as much detail as possible for you incident.</li>
</ul>

	</ul>
	<span class="graytitle">Reporters Name</span>
        
	<ul class="pageitem">
        
		<li class="smallfield"><span class="firstname">First Name</span><input placeholder="firstname" type="text" />
		</li>
            
            <li class="smallfield"><span class="lastname">Last Name</span><input placeholder="lastname" type="text" />
            
            <li class="smallfield"><span class="jobtitle">Reporter job title</span><input placeholder="job title" type="text" />
            
    <li class="smallfield"><span class="email">Email</span><input placeholder="email" type="text" />
    
                <li class="smallfield"><span class="mobile">Phone </span><input placeholder="mobile" type="text" />			
        </ul>
        
        </ul>


              
              
	</ul>
	<span class="graytitle">  Details of the Incident</span>
        
	<ul class="pageitem">
		            
            <li class="smallfield"><span class="date">Incident Date</span><input placeholder="date" type="text" />
		</li>
            
               <li class="smallfield"><span class="time">Incident Time</span><input placeholder="time" type="text" />
		</li>
                          
            
            </ul>
            		</ul>
	<span class="graytitle">Description of the Incident</span>
	<ul class="pageitem">
        
		<li class="textbox"><span class="describetheincident">Describe the Incident:</span><textarea name="TextArea" rows="4"></textarea></li>
            
            <li class="textbox"><span class="describeimmediateactions">Describe Immediate Actions:</span><textarea name="TextArea" rows="4"></textarea></li>
            
             <li class="textbox"><span class="describeanycontributingfactors">Describe Any Contributing Factors:</span><textarea name="TextArea" rows="4"></textarea></li>
             
	</ul>
        
        
     <form method="post" action="sendmail.php">


  <input type="submit" />
  

  
</form>


        
  		</ul>

            
        



</div>
<div id="footer">
<a href="http://qualityhub.co.nz">Powered by Qualityhub.co.nz</a></div>

</body>

</html>

 

 

Link to comment
Share on other sites

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.