Hi,
Having problems with the PHP on my site. I will paypal $10 to the first person who can solve this very simple problem.
I have a contact form and i want the email form to appear as sent from when the email is sent. See beneath for the code
<?php $site_admin = '[email protected]';
// function ae_send_mail (see code above) is pasted here
if(isset($_REQUEST['subcheck']) == "ys")
{ if($_POST['subject'] == "" || $_POST['name'] == "" || $_POST['message'] == "")
{
$false = true;
}
else
{
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: $_POST['email'], <'.$_REQUEST["name"].'>' . "\r\n";
mail($site_admin, $_POST['subject'], $_POST['message'],$headers);
$mail_send = true;
}
}
?>
<!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>730 Promo | Contact Us</title>
<link type="text/css" href="css/style.css" rel="stylesheet" />
<!--[if gte IE 7]>
<link href="css/style_ie7.css" rel="stylesheet" type="text/css" />
<![endif]-->
<!--[if gte IE 8]>
<link href="css/style_ie8.css" rel="stylesheet" type="text/css" />
<![endif]-->
<style type="text/css">
img, div { behavior: url("iepngfix.htc") }
</style>
</head>
<body>
<!--header start-->
<div id="wrapper">
<!--top start-->
<div id="top">
<div id="top_inner"> <div id="main_menu">
<ul>
<li><a href="index.html" class="home"></a></li>
<li><a href="aboutus.html" class="aboutus"></a></li>
<li><a href="clients.html" class="clients"></a></li>
<li><a href="services.html" class="services"></a></li>
<li><a href="contact.html" class="contact_active"></a></li>
</ul>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<!--top end-->
<!--content start-->
<div id="content">
<!--content main start-->
<div id="content_main">
<!--banner start-->
<div id="banner">
<h1>Digital Marketing & Promotion company</h1>
<div class="clear"></div>
<p><span>Past and present clients</span><br />
LLOYD BANKS (G-UNIT) | SWAY | LEVI ROOTS | LOWKEYÂ | S.A.S | <br />
MARVELL | KLASHNEKOFF | STYLAH | SKANDAL</p>
<div class="clear"></div>
<div id="learn"><a href="aboutus.html"><img src="images/learnmore.png" width="132" height="35"
alt="Learn More"/></a></div>
</div>
<!--banner end-->
<!--contact start-->
<div id="contact">
<div id="contact_title">
<h2><span>Contact us</span></h2></div>
<div id="contact_body">
<div class="service_category">
<p class="service_title"><span class="address"><strong>Email</strong>:
[email protected]</span></p>
<p class="service_title">Â </p>
<p class="service_title">Â </p>
<p class="service_title">Phone : +44 (0)7794043670</p>
<div class="clear"></div>
</div>
<?php
if (isset($mail_send)) {
echo "<p style='margin:100px 0 0 15px; color:#606060; text-align:center;
font-weight:bold; font-size:18px;'>Form has been submitted. Thank You!</p>";
}
else {
if($false == true)
{
echo "<p style='margin:15px 0 0 15px;'><span style='color:#F00; text-
align:left; font-weight:bold;'>All fields are required</span></p>";
}
?>
<form name="contact_frm" id="contact_frm" action="" method="post" >
<p class="service_title">Contact Form</p>
<p>Â </p>
<table width="600" border="0" cellspacing="10" cellpadding="5">
<tr>
<td width="133"><strong>Your Name *</strong></td>
<td width="417"><input class="text" type="text" name="name"
id="name" value="<?php echo $_POST['name'];?>"></td>
</tr>
<tr>
<td><strong>Subject *</strong></td>
<td><input class="text" type="text" name="subject" id="subject"
<?php echo $_POST['subject'];?> ></td>
</tr>
<tr>
<td><strong>Email Address *</strong></td>
<td><input class="text" type="text" name="email" id="email" <?php echo $_POST['email'];?> ></td>
</tr>
<tr>
<td><strong>Your Message *</strong></td>
<td><textarea cols="40" rows="6" name="message" id="message" <?php
echo $_POST['message'];?>></textarea>
<input type="hidden" name="subcheck" value="ys" />
</td>
</tr>
<tr>
<td>Â </td>
<td>Â </td>
</tr>
<tr>
<td>Â </td>
<td><a href="javascript:submitform()"><img
src="images/submit_btn.gif" width="64" height="27" alt="Submit"/></a>Â Â Â <a
href="javascript:resetform()"><img src="images/reset_btn.gif" width="64" height="27" alt="Reset"/></a></td>
</tr>
</table>
</form>
<?php } ?>
<div class="clear"></div>
</div>
<div id="contact_btm"><img src="images/round_btn.png" alt="border"/></div>
</div>
<!--overview end-->
<!--casestudy start-->
<!--casestudy end-->
<div class="clear"></div>
</div>
<!--content main end-->
<!--footer start-->
<div id="footer">
<div id="social_icons">
<p>Find Us On</p>
<p class="icons"><img src="images/social_icons.png" width="46" height="20" border="0"
usemap="#Map" alt="Social Icons"/>
<map name="Map" id="Map">
<area shape="rect" coords="0,0,18,19" href="http://www.facebook.com/730promo"
alt="Facebook" />
<area shape="rect" coords="24,0,46,20" href="http://wwww.twitter.com/730promo"
alt="Twitter" />
</map>
</p>
</div>
<div id="footer_menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="aboutus.html">About Us</a></li>
<li><a href="clients.html">Clients</a></li>
<li><a href="services.html">Services</a></li>
<li class="last"><a href="contactus.html">Contact Us</a></li>
</ul>
</div>
</div>
<!--footer end-->
</div>
<!--content end-->
</div>
<!--header end-->
</body>
</html>
<script>
function submitform()
{
document.getElementById('contact_frm').submit();
}
function resetform()
{
document.getElementById('name').value="";
document.getElementById('subject').value="";
document.getElementById('message').value="";
}
</script>
Having problems with the PHP on my site. I will paypal $10 to the first person who can solve this very simple problem.
I have a contact form and i want the email form to appear as sent from when the email is sent. See beneath for the code
<?php $site_admin = '[email protected]';
// function ae_send_mail (see code above) is pasted here
if(isset($_REQUEST['subcheck']) == "ys")
{ if($_POST['subject'] == "" || $_POST['name'] == "" || $_POST['message'] == "")
{
$false = true;
}
else
{
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: $_POST['email'], <'.$_REQUEST["name"].'>' . "\r\n";
mail($site_admin, $_POST['subject'], $_POST['message'],$headers);
$mail_send = true;
}
}
?>
<!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>730 Promo | Contact Us</title>
<link type="text/css" href="css/style.css" rel="stylesheet" />
<!--[if gte IE 7]>
<link href="css/style_ie7.css" rel="stylesheet" type="text/css" />
<![endif]-->
<!--[if gte IE 8]>
<link href="css/style_ie8.css" rel="stylesheet" type="text/css" />
<![endif]-->
<style type="text/css">
img, div { behavior: url("iepngfix.htc") }
</style>
</head>
<body>
<!--header start-->
<div id="wrapper">
<!--top start-->
<div id="top">
<div id="top_inner"> <div id="main_menu">
<ul>
<li><a href="index.html" class="home"></a></li>
<li><a href="aboutus.html" class="aboutus"></a></li>
<li><a href="clients.html" class="clients"></a></li>
<li><a href="services.html" class="services"></a></li>
<li><a href="contact.html" class="contact_active"></a></li>
</ul>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<!--top end-->
<!--content start-->
<div id="content">
<!--content main start-->
<div id="content_main">
<!--banner start-->
<div id="banner">
<h1>Digital Marketing & Promotion company</h1>
<div class="clear"></div>
<p><span>Past and present clients</span><br />
LLOYD BANKS (G-UNIT) | SWAY | LEVI ROOTS | LOWKEYÂ | S.A.S | <br />
MARVELL | KLASHNEKOFF | STYLAH | SKANDAL</p>
<div class="clear"></div>
<div id="learn"><a href="aboutus.html"><img src="images/learnmore.png" width="132" height="35"
alt="Learn More"/></a></div>
</div>
<!--banner end-->
<!--contact start-->
<div id="contact">
<div id="contact_title">
<h2><span>Contact us</span></h2></div>
<div id="contact_body">
<div class="service_category">
<p class="service_title"><span class="address"><strong>Email</strong>:
[email protected]</span></p>
<p class="service_title">Â </p>
<p class="service_title">Â </p>
<p class="service_title">Phone : +44 (0)7794043670</p>
<div class="clear"></div>
</div>
<?php
if (isset($mail_send)) {
echo "<p style='margin:100px 0 0 15px; color:#606060; text-align:center;
font-weight:bold; font-size:18px;'>Form has been submitted. Thank You!</p>";
}
else {
if($false == true)
{
echo "<p style='margin:15px 0 0 15px;'><span style='color:#F00; text-
align:left; font-weight:bold;'>All fields are required</span></p>";
}
?>
<form name="contact_frm" id="contact_frm" action="" method="post" >
<p class="service_title">Contact Form</p>
<p>Â </p>
<table width="600" border="0" cellspacing="10" cellpadding="5">
<tr>
<td width="133"><strong>Your Name *</strong></td>
<td width="417"><input class="text" type="text" name="name"
id="name" value="<?php echo $_POST['name'];?>"></td>
</tr>
<tr>
<td><strong>Subject *</strong></td>
<td><input class="text" type="text" name="subject" id="subject"
<?php echo $_POST['subject'];?> ></td>
</tr>
<tr>
<td><strong>Email Address *</strong></td>
<td><input class="text" type="text" name="email" id="email" <?php echo $_POST['email'];?> ></td>
</tr>
<tr>
<td><strong>Your Message *</strong></td>
<td><textarea cols="40" rows="6" name="message" id="message" <?php
echo $_POST['message'];?>></textarea>
<input type="hidden" name="subcheck" value="ys" />
</td>
</tr>
<tr>
<td>Â </td>
<td>Â </td>
</tr>
<tr>
<td>Â </td>
<td><a href="javascript:submitform()"><img
src="images/submit_btn.gif" width="64" height="27" alt="Submit"/></a>Â Â Â <a
href="javascript:resetform()"><img src="images/reset_btn.gif" width="64" height="27" alt="Reset"/></a></td>
</tr>
</table>
</form>
<?php } ?>
<div class="clear"></div>
</div>
<div id="contact_btm"><img src="images/round_btn.png" alt="border"/></div>
</div>
<!--overview end-->
<!--casestudy start-->
<!--casestudy end-->
<div class="clear"></div>
</div>
<!--content main end-->
<!--footer start-->
<div id="footer">
<div id="social_icons">
<p>Find Us On</p>
<p class="icons"><img src="images/social_icons.png" width="46" height="20" border="0"
usemap="#Map" alt="Social Icons"/>
<map name="Map" id="Map">
<area shape="rect" coords="0,0,18,19" href="http://www.facebook.com/730promo"
alt="Facebook" />
<area shape="rect" coords="24,0,46,20" href="http://wwww.twitter.com/730promo"
alt="Twitter" />
</map>
</p>
</div>
<div id="footer_menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="aboutus.html">About Us</a></li>
<li><a href="clients.html">Clients</a></li>
<li><a href="services.html">Services</a></li>
<li class="last"><a href="contactus.html">Contact Us</a></li>
</ul>
</div>
</div>
<!--footer end-->
</div>
<!--content end-->
</div>
<!--header end-->
</body>
</html>
<script>
function submitform()
{
document.getElementById('contact_frm').submit();
}
function resetform()
{
document.getElementById('name').value="";
document.getElementById('subject').value="";
document.getElementById('message').value="";
}
</script>