Send Emails with a Web Form: PHP Scripting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rjhe22
Forum Newbie
Posts: 9
Joined: Fri Sep 24, 2010 9:57 am

Send Emails with a Web Form: PHP Scripting

Post by rjhe22 »

hi i have this script done up but when i press the submint button nothing happens any ideas

Code: Select all

<html>
<head>
<title>Form from Tutvid.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
	background-color: #f1f1f1;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	line-height: normal;
	font-weight: normal;
	color: #666666;
	text-decoration: none;
}
#formHolder {
	width: 800px;
	background-color: e1e1e1;
}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div id="formHolder">
  <form name="form1" method="post" action="contactformprocess.php">
    <table width="100%" border="0" cellspacing="0" cellpadding="6">
      <tr>
        <td><label for="email">
            <div align="right">Email Address:</div>
          </label>
        </td>
        <td><div align="left">
          <input name="email" type="text" id="email" size="35" maxlength="100">
        </div></td>
      </tr>
      <tr>
        <td><label for="name">
            <div align="right">Name:</div>
          </label>
        </td>
        <td><div align="left">
          <input name="name" type="text" id="name" size="35" maxlength="80">
        </div></td>
      </tr>
      <tr>
        <td><label for="phone">
            <div align="right">Phone:</div>
          </label>
        </td>
        <td><div align="left">
          <input name="phone" type="text" id="phone" size="35" maxlength="12">
        </div></td>
      </tr>
      <tr>
        <td><div align="right">Response:</div></td>
        <td><p align="left">
          <label>
            <input type="radio" name="budget" value="lessthan1000" id="budget_0">
            Yes I am interested in a meeting. Please contact me to arrange a meeting</label>
          <br>
          <label>
            <input type="radio" name="budget" value="1000to5000" id="budget_1">
            Yes I am interested in a meeting but at a later date. Please contact me in a months time</label>
          <br>
          <label>
            <input type="radio" name="budget" value="5000to10000" id="budget_2">
           No I do not require a meeting</label>
          
          <br>
        </p></td>
      </tr>
      <tr>
        
      <tr>
        <td><div align="right">
          <label for="clear"></label>
          <input type="reset" name="clear" id="clear" value="Reset Form">
        </div></td>
        <td><div align="right">
          <label for="submit"></label>
          <div align="left">
            <input type="submit" name="submit" id="submit" value="Send Email!">
          </div>
        </div></td>
      </tr>
    </table>
  </form>
  <p align="center">&nbsp; </p>
</div>
</body>
</html>
rjhe22
Forum Newbie
Posts: 9
Joined: Fri Sep 24, 2010 9:57 am

Re: Send Emails with a Web Form: PHP Scripting

Post by rjhe22 »

o this is the php code

Code: Select all

<?php

/* subject and email*/

	$emailSubject = ' crazy email scripting !';
	$webMaster = 'RHealy@harvest-financial.ie';
	
/* getting data */

	$emailField - $_POST [ 'email '] ;
	$nameField - $_POST [ ' name '] ;
	$phoneField - $_POST [ ' phone'] ;
	$responseField - $_POST [ ' response '] ;
	
	
	$body = <<<EOD
<br><hr><br>
Email: $Email <br>
Name: $Name <br>
Phone: $Phone <br>
Response: $Response <br>
EOD;


	$headers - "From: $email\r\n";
	$headers .- "Content-type; text/html\r\n";
	$success - mail($webMaster, $emailSubject, $body, $headers);
	
	
/* results*/

$theResults - <<<EOD
<html>
<head>
<title>JakesWorks - travel made easy-Homepage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
	background-color: #f1f1f1;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	line-height: normal;
	font-weight: normal;
	color: #666666;
	text-decoration: none;
}
-->
</style>
</head>

<div>
  <div align="left">Thank you for your interest! Your email will be answered very soon!</div>
</div>
</body>
</html>

EOD;
echo "$theResults";


	
	
?>
rjhe22
Forum Newbie
Posts: 9
Joined: Fri Sep 24, 2010 9:57 am

Re: Send Emails with a Web Form: PHP Scripting

Post by rjhe22 »

this is fixed now
Post Reply