Cannot Modify Header Iformation - php

I am getting this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/renta142/public_html/includes/connection_prop.php:14) in /home/renta142/public_html/login.php on line 31
My PHP Code is:
<?php
session_start();
if($_SESSION['user']['id']!=""){
header("location:index.php");
exit();
}
$login_email=$_POST[email];
$username=$_POST[username1];
$name=$_POST[name];
$er=$_POST[er];
if(trim($_POST["SignIn"])=="Sign In"){
include("includes/connection_user.php");
$user_=$_POST["username"];
$pass=$_POST["pass"];
$query=mysql_query("select * from user_registration where UserID='".$user_."' and Password='".$pass."' and Display='1'");
$result=mysql_fetch_array($query);
if(!strcmp($result[Password],$pass)){
$_SESSION['user']['id'] = $result[AID];
$_SESSION['user']['password'] = $result[Password];
$_SESSION['user']['username'] = $result[UserID];
$_SESSION['user']['name']=$result[Name];
$ref=$_SESSION["refer_url"];
if($_REQUEST['ref']=="sell"){
header("Location:postproperty_sell.php");
exit();
}
else if($ref==""){
header("Location:postproperty.php");
exit();
}
else{
header("Location:$ref");
exit();
}
}else{
$errsg="Invalid Username and Password !";
}
mysql_close();
}
include("config.php");
$sitename=ucfirst($thirdsite)." - Property in ".ucfirst($addresscity);
$keys="property in ".ucfirst($addresscity);
$desc="Real estate agents offers - property in ".ucfirst($addresscity);
include("includes/header.php");
include("includes/left.php");
?>
<script language='javascript' src="images/script.js"></script>
<script type="text/javascript">
function popUp_file(URL){
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=1,statusbar=0,menubar=0,resizable=0,width=900,height=600');");
}
<?php if($_REQUEST[fcode]=='wrong'){?>
window.onload=function(){document.getElementById('fpass').style.display='block';}
<?php }?>
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<td valign="top" align="center" colspan="2">
<table width="794" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" align="right" valign="bottom"><img src="images/11.jpg" width="10" height="10" alt="" /></td>
<td width="97%" style="background:url(images/12.jpg) repeat-x bottom;"> </td>
<td width="2%" align="left" valign="bottom"><img src="images/13.jpg" width="10" height="10" alt="" /></td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" class="green"> </td>
<td> </td>
</tr>
<tr>
<td align="left" valign="middle" class="green"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="5%"><img src="images/customer_login.gif" alt="CUSTOMER LOGIN" width="24" height="23" /></td>
<td width="92%">PROPERTY OWNER LOGIN </td>
</tr>
</table></td>
<td align="left" class="green"><table width="100%" border="0" cellpadding="00" cellspacing="0">
<tr>
<td width="5%"><img src="images/mbenifites.gif" alt="MEMBERSHIP BENEFITS" width="16" height="17" /></td>
<td width="92%"> FREE MEMBERSHIP BENEFITS</td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"> </td>
<td valign="top"> </td>
</tr>
<tr>
<td width="50%" valign="top"><?php if($errsg){ echo "<br /><div class='alert' align='center'>".$errsg."</div><br />"; } ?>
<table width="100%" cellpadding="4" cellspacing="1" class="heading" valign="top">
<form action="login.php?ref=<?php echo $_REQUEST['ref']; ?>" method="post" name="signin" id="signin" onsubmit="return loginform();">
<tr>
<td class="txt">Username<font color="red">*</font></td>
<td width="1" align="left"><strong>:</strong></td>
<td align="left"><input name="username" type="text" id="username" onfocus="if(this.value=='Username') this.value='';" onblur="if(this.value=='') this.value='Username';" value="Username" /></td>
</tr>
<tr>
<td class="txt">Password<font color="red">*</font></td>
<td align="left"><strong>:</strong></td>
<td align="left"><input type="password" name="pass" onfocus="if(this.value=='**********') this.value='';" onblur="if(this.value=='') this.value='**********'" value="**********" /></td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td align="left"><input type="submit" name="SignIn" value="Sign In" class="button" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td align="left"><font color="#333333" size="2" face="Arial, Helvetica, sans-serif"> <img src="images/nuser.gif" alt="New User registration" width="19" height="21" alt="" /> New User ?</font><a href="login.php#reg"><font color="#0000FF" size="2" face="Arial, Helvetica, sans-serif">Register First</font><br />
</a> <font color="#0000FF" size="2" face="Arial, Helvetica, sans-serif">Forgot Password </font></td>
</tr>
</form>
</table></td>
<td width="50%" valign="top" style="background:url(images/login_page.jpg) no-repeat right; height:200px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="11%" align="center" valign="top" style="padding-top:8px;"><img src="images/bullet-cir1.jpg" width="8" height="8" alt="" /></td>
<td width="89%" valign="top"><font size="2" face="Arial, Helvetica, sans-serif">Advertise your properties for Sale/Rent/PG </font></td>
</tr>
<tr>
<td align="center" valign="top" style="padding-top:8px;"><img src="images/bullet-cir1.jpg" width="8" height="8" alt="" /></td>
<td valign="top"><font size="2" face="Arial, Helvetica, sans-serif">Get Special offers and freebies</font></td>
</tr>
<tr>
<td align="center" valign="top" style="padding-top:8px;"><img src="images/bullet-cir1.jpg" width="8" height="8" alt="" /></td>
<td valign="top"><font size="2" face="Arial, Helvetica, sans-serif">Get updates on our new products</font></td>
</tr>
<tr>
<td align="center" valign="top" style="padding-top:8px;"><img src="images/bullet-cir1.jpg" width="8" height="8" alt="" /></td>
<td valign="top"><font size="2" face="Arial, Helvetica, sans-serif">Response through mail, phone</font></td>
</tr>
</table> </td>
</tr>
</table></td></tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" ><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="border:#3399FF 1px solid;">
<tr>
<td align="left" bgcolor="#E1F1F4" style="padding-left:3px; padding-right:3px;"> <strong><font size="2" face="Arial, Helvetica, sans-serif"><img src="images/note.gif" alt="<?php echo $thirdsite ?>is commited your information is strictly confidential, unless you want to expose it." width="19" height="18" /> Note:</font></strong></td>
</tr>
<tr>
<td align="center" bgcolor="#E1F1F4" style="padding-left:3px; padding-right:3px;"><div align="justify" style="padding-left:3px; padding-right:3px;"><font color="#666666" size="2" face="Arial, Helvetica, sans-serif"> <?php echo ucfirst($thirdsite); ?> is commited your information is strictly confidential, unless you want to expose it.</font></div></td>
</tr>
<tr>
<td align="center" bgcolor="#E1F1F4"> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table></td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td align="right" valign="top"><img src="images/31.jpg" width="10" height="10" alt="" /></td>
<td style="background:url(images/32.jpg) repeat-x top;"> </td>
<td align="left" valign="top"><img src="images/33.jpg" width="10" height="10" alt="" /></td>
</tr>
</table></td>
</tr>
<tr>
<td></td>
</tr>
</table>
<a name="fp"></a>
<div id="fpass" style="display:none;">
<table width="794" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" align="right" valign="bottom"><img src="images/11.jpg" width="10" height="10" alt="" /></td>
<td width="97%" style="background:url(images/12.jpg) repeat-x bottom;"> </td>
<td width="2%" align="left" valign="bottom"><img src="images/13.jpg" width="10" height="10" alt="" /></td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left"> </td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left"><table width="100%" border="0" cellpadding="00" cellspacing="0">
<tr>
<td width="3%"><span class="green"><img src="images/forget_pass.gif" alt="FORGOT PASSWORD" width="20" height="19" /></span></td>
<td width="97%"><span class="green"> FORGOT PASSWORD</span></td>
</tr>
</table></td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td><table width="100%" border="0" align="right" cellpadding="2" cellspacing="0">
<form action="forget_password_submit.php" method="post" name="forget_password" id="forget_password">
<input type="hidden" name="chk" value="2" />
<?php if($_GET[fcode]) echo ' <tr>
<td class="alert" align="center" colspan="3">Your EmailID or UserName Is Not Found In Our Database, Please Try Again!!!</td></tr>';?>
<tr >
<td width="20%" align="right" valign="top" class="txt"> Username</td>
<td width="2%" valign="top"><b>:</b></td>
<td width="78%" align="left" valign="top"><input type="text" name="username1" /></td>
</tr>
<tr>
<td colspan="2" align="right" class="heading"> OR</td>
<td class="heading" align="left"> </td>
</tr>
<tr>
<td align="right" valign="top" class="txt"> Email-ID</td>
<td valign="top"><b>:</b></td>
<td align="left" valign="top"><input type="text" name="email1" /></td>
</tr>
<tr>
<td colspan="3" align="right" height="8"></td>
</tr>
<tr>
<td align="right"> </td>
<td align="center"> </td>
<td align="left"><input name="submit" type="submit" onclick="return ForgetpassForm();" value="Submit" class="button" /></td>
</tr>
<tr>
<td align="right"> </td>
<td align="right"> </td>
<td align="left"><font color="#333333" size="2" face="Arial, Helvetica, sans-serif"><img src="images/login.gif" alt="Existin user login" width="19" height="21" /></font> <font color="#0000FF" size="2" face="Arial, Helvetica, sans-serif"><strong>Login</strong></font></td>
</tr>
<tr>
<td align="right" colspan="4" height="8"></td>
</tr>
<tr>
<td colspan="3" align="right"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="border:#3399FF 1px solid;">
<tr>
<td align="left" bgcolor="#E1F1F4" style="padding-left:3px; padding-right:3px;"> <strong><font size="2" face="Arial, Helvetica, sans-serif"><img src="images/note.gif" alt="Enter Your UserName or Email-ID which you had entered in registration form and get your password through eMail." width="19" height="18" /></font></strong><strong><font size="2" face="Arial, Helvetica, sans-serif"> Note:</font></strong></td>
</tr>
<tr>
<td align="center" bgcolor="#E1F1F4" style="padding-left:3px; padding-right:3px;"><div align="justify" style="padding-left:3px; padding-right:3px;"><span class="text"> Enter Your UserName or Email-ID which you had entered in registration form and get your password through eMail. </span></div></td>
</tr>
<tr>
<td align="center" bgcolor="#E1F1F4"> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3" align="center" height="7"></td>
</tr>
</form>
</table></td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td align="right" valign="top"><img src="images/31.jpg" width="10" height="10" alt="" /></td>
<td style="background:url(images/32.jpg) repeat-x top;"> </td>
<td align="left" valign="top"><img src="images/33.jpg" width="10" height="10" alt="" /></td>
</tr>
</table></td>
</tr>
</table>
</div>
<?php //if($errsg=="Invalid Username and Password !"){?>
<a name="reg"></a>
<table width="794" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" align="right" valign="bottom"><img src="images/11.jpg" width="10" height="10" alt="" /></td>
<td width="97%" style="background:url(images/12.jpg) repeat-x bottom;"> </td>
<td width="2%" align="left" valign="bottom"><img src="images/13.jpg" width="10" height="10" alt="" /></td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left"> </td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left" class="heading"><table width="100%" border="0" cellpadding="00" cellspacing="0">
<tr>
<td width="3%"><img src="images/if_you_do.gif" alt="If you do not have an existing Customer Account with us fill in the form below" width="19" height="19" /></td>
<td width="97%"> If you do not have an existing User Account with us fill in the form below. </td>
</tr>
</table></td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left"> </td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td align="right" valign="top"><img src="images/31.jpg" width="10" height="10" alt="" /></td>
<td style="background:url(images/32.jpg) repeat-x top;"> </td>
<td align="left" valign="top"><img src="images/33.jpg" width="10" height="10" alt="" /></td>
</tr>
</table></td>
</tr>
</table>
<table width="794" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" align="right" valign="bottom"><img src="images/11.jpg" width="10" height="10" alt="" /></td>
<td width="97%" style="background:url(images/12.jpg) repeat-x bottom;"> </td>
<td width="2%" align="left" valign="bottom"><img src="images/13.jpg" width="10" height="10" alt="" /></td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left" class="green"><table width="100%" border="0" cellpadding="00" cellspacing="0">
<tr>
<td width="5%"><img src="images/NEW-USER-REGISTER-FORM.gif" alt="NEW USER REGISTER FORM " width="26" height="27" /></td>
<td width="97%"> NEW USER REGISTER FORM </td>
</tr>
</table></td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left"> </td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left"><form name="register" method="POST" action="registration_submit.php?ref=<?php echo $_REQUEST['ref']; ?>" onsubmit="return registerForm();">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" valign="top" style="border:#CCCCCC 1px solid;">
<table width="100%" cellpadding="4" cellspacing="0">
<tr>
<td bgcolor="#EEEEEE"><font size="2" face="Arial, Helvetica, sans-serif">User Login Information</font></td>
<td bgcolor="#EEEEEE"> </td>
<td align="right" bgcolor="#EEEEEE"><span class="alert">* Mandatory Fields</span></td>
</tr>
<tr>
<td width="39%" class="tdspace txt"><font color="red">*</font>Username</td>
<td width="3%">:</td>
<td width="58%"><input name="username" type="text" id="username" size="25" /></td>
</tr>
<tr>
<td class="tdspace txt"><font color="red">*</font>Password</td>
<td>:</td>
<td><input type="password" name="password" size="25" /></td>
</tr>
<tr>
<td class="tdspace txt"><font color="red">*</font>Confirm Password</td>
<td>:</td>
<td><input type="password" name="rpassword" size="25" /></td>
</tr>
<tr>
<td class="tdspace txt"><font color="red">*</font>Email-ID</td>
<td>:</td>
<td><input type="text" name="email" size="25" /></td>
</tr>
<tr>
<td colspan="3" bgcolor="#EEEEEE"><font size="2" face="Arial, Helvetica, sans-serif">Contact Information</font></td>
</tr>
<tr>
<td class="tdspace txt"><font color="red">*</font>Name</td>
<td>:</td>
<td><input type="text" name="name" size="25" /></td>
</tr>
<tr>
<td class="tdspace txt"><font color="red">*</font>Verification Code</td>
<td>:</td>
<td><input name="verify_code" type="text" size="15" />
<img src="verificationimage.php" alt="verification image, type it in the box" width="60" height="30" align="absbottom"/></td>
</tr>
<tr>
<td colspan="3" class="text"><input type="checkbox" name="term" />
I have read <font color="red">Terms and Conditions</font> and I accept these conditions.</td>
</tr>
<tr>
<td align="center"> </td>
<td align="center"> </td>
<td align="left"><input name="submit2" type="submit" value="Submit" class="button" />
<input name="reset" type="reset" value="Reset" class="button" />
<input name="flg" type="hidden" id="flg" value="1" /></td>
</tr>
</table></td>
<td width="1%" > </td>
<td width="49%" valign="top"><img src="images/register.jpg" alt="For Free registration on <?php echo ucfirst($thirdsite); ?>, Advertise your properties for Sale/Rent/PG, Get Special offers and freebies, Get updates on our new products, Response through mail, phone" width="380" height="380" /></td>
</tr>
</table>
</form></td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td align="right" valign="top"><img src="images/31.jpg" width="10" height="10" alt="" /></td>
<td style="background:url(images/32.jpg) repeat-x top;"> </td>
<td align="left" valign="top"><img src="images/33.jpg" width="10" height="10" alt="" /></td>
</tr>
</table></td>
</tr>
</table>
<?php //}?>
</td>
<script language='javascript'>signin.username.focus();</script>
<?php
//include("includes/right.php");
include("includes/footer.php");
?>

public_html/includes/connection_prop.php:14 is probably outputting some blank spaces. Check that file and other includes for whitespace around tags.
You cannot send headers if any text has already been output

Related

PHP Submit button not responding (Codeigniter)

I have the following view (home_view.php)
<?php $this->load->helper('url');
?>
<!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=utf-8" />
<title>diluks eCommerce - Home</title>
<link href="<?php echo base_url();?>Public/scripts/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form action="<?php echo base_url();?>index.php/welcome_controller" method="post">
<div class="container">
<?php
$userpermission = $this->session->userdata('userpermission');
if($userpermission==1){
include 'header-admin.php';
}
else if($userpermission==2){
include 'header-user.php';
}
else{
include 'header-guest.php';}
?>
<div class="level3 clearfix">
<?php include 'shopping-sidebar.php'; ?>
<div class="body-content">
<div class="image-slider">
<img src="<?php echo base_url();?>Public/img/main-img.png" width="785" height="220" />
</div>
<div class="seperate-space">
<div class="separate-title"><a class="bold-captions">Latest Picks</a>
</div>
</div>
<div class="items">
<div class="item-holder">
<table align="center" width="256px" cellpadding="0px" cellspacing="0px">
<tr>
<td class="item-info" align="center" height="34px">Item name</td>
</tr>
<tr>
<td class="item-info" align="center" height="230px">
<img src="<?php echo base_url();?>Public/img/sunflowers.png" width="256" height="230" />
</td>
</tr>
<tr>
<td class="item-info" align="center" height="34px">$30</td>
</tr>
<tr>
<td class="item-info" align="center" height="35px"><input name="btn_read" class="readbtn" value="Read More" /></td>
</tr>
</table>
</div>
<div class="item-holder">
<table align="center" width="256px" cellpadding="0px" cellspacing="0px">
<tr>
<td class="item-info" align="center" height="34px">Item name</td>
</tr>
<tr>
<td class="item-info" align="center" height="230px">
<img src="<?php echo base_url();?>Public/img/treecard.png" width="256" height="230" />
</td>
</tr>
<tr>
<td class="item-info" align="center" height="34px">$30</td>
</tr>
<tr>
<td class="item-info" align="center" height="35px"><input name="btn_read" class="readbtn" value="Read More" /></td>
</tr>
</table>
</div>
<div class="item-holder">
<table align="center" width="256px" cellpadding="0px" cellspacing="0px">
<tr>
<td class="item-info" align="center" height="34px">Item name</td>
</tr>
<tr>
<td class="item-info" align="center" height="230px">
<img src="<?php echo base_url();?>Public/img/3-flowers.png" width="256" height="230" />
</td>
</tr>
<tr>
<td class="item-info" align="center" height="34px">$30</td>
</tr>
<tr>
<td class="item-info" align="center" height="35px"><input name="btn_read" class="readbtn" value="Read More" /></td>
</tr>
</table>
</div>
<div class="item-holder">
<table align="center" width="256px" cellpadding="0px" cellspacing="0px">
<tr>
<td class="item-info" align="center" height="34px">Item name</td>
</tr>
<tr>
<td class="item-info" align="center" height="230px">
<img src="<?php echo base_url();?>Public/img/sunflowers.png" width="256" height="230" />
</td>
</tr>
<tr>
<td class="item-info" align="center" height="34px">$30</td>
</tr>
<tr>
<td class="item-info" align="center" height="35px"><input name="btn_read" class="readbtn" value="Read More" /></td>
</tr>
</table>
</div>
<div class="item-holder">
<table align="center" width="256px" cellpadding="0px" cellspacing="0px">
<tr>
<td class="item-info" align="center" height="34px">Item name</td>
</tr>
<tr>
<td class="item-info" align="center" height="230px">
<img src="<?php echo base_url();?>Public/img/treecard.png" width="256" height="230" />
</td>
</tr>
<tr>
<td class="item-info" align="center" height="34px">$30</td>
</tr>
<tr>
<td class="item-info" align="center" height="35px"><input name="btn_read" class="readbtn" value="Read More" /></td>
</tr>
</table>
</div>
<div class="item-holder">
<table align="center" width="256px" cellpadding="0px" cellspacing="0px">
<tr>
<td class="item-info" align="center" height="34px">Item name</td>
</tr>
<tr>
<td class="item-info" align="center" height="230px">
<img src="<?php echo base_url();?>Public/img/3-flowers.png" width="256" height="230" />
</td>
</tr>
<tr>
<td class="item-info" align="center" height="34px">$30</td>
</tr>
<tr>
<td class="item-info" align="center" height="35px"><input name="btn_read" class="readbtn" value="Read More" /></td>
</tr>
</table>
</div>
<div class="item-holder">
<table align="center" width="256px" cellpadding="0px" cellspacing="0px">
<tr>
<td class="item-info" align="center" height="34px">Item name</td>
</tr>
<tr>
<td class="item-info" align="center" height="230px">
<img src="<?php echo base_url();?>Public/img/sunflowers.png" width="256" height="230" />
</td>
</tr>
<tr>
<td class="item-info" align="center" height="34px">$30</td>
</tr>
<tr>
<td class="item-info" align="center" height="35px"><input name="btn_read" class="readbtn" value="Read More" /></td>
</tr>
</table>
</div>
<div class="item-holder">
<table align="center" width="256px" cellpadding="0px" cellspacing="0px">
<tr>
<td class="item-info" align="center" height="34px">Item name</td>
</tr>
<tr>
<td class="item-info" align="center" height="230px">
<img src="<?php echo base_url();?>Public/img/treecard.png" width="256" height="230" />
</td>
</tr>
<tr>
<td class="item-info" align="center" height="34px">$30</td>
</tr>
<tr>
<td class="item-info" align="center" height="35px"><input name="btn_read" class="readbtn" value="Read More" /></td>
</tr>
</table>
</div>
<div class="item-holder">
<table align="center" width="256px" cellpadding="0px" cellspacing="0px">
<tr>
<td class="item-info" align="center" height="34px">Item name</td>
</tr>
<tr>
<td class="item-info" align="center" height="230px">
<img src="<?php echo base_url();?>Public/img/3-flowers.png" width="256" height="230" />
</td>
</tr>
<tr>
<td class="item-info" align="center" height="34px">$30</td>
</tr>
<tr>
<td class="item-info" align="center" height="35px"><input name="btn_read" class="readbtn" value="Read More" /></td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div style="clear:both"></div>
<div class="level4">
<div class="footer-area">
<div class="lined-space"></div>
<div class="site-map" align="left">
<table>
<tr>
<td class="footer-text">About Us</td>
<td class="footer-text">Facebook</td>
</tr>
<tr>
<td class="footer-text">Contact Us</td>
<td class="footer-text">Twitter</td>
</tr>
<tr>
<td class="footer-text">FAQs</td>
<td class="footer-text">Terms & Conditions</td>
</tr>
<tr>
<td class="footer-text">Help</td>
</tr>
</table>
</div>
<div class="developer-info">
<a class="developers-text">Designed & Developed By Diluks Software Solutions.</a>
</div>
</div>
</div>
</div>
</form>
</body>
</html>
And the controller for that (welcome_controller) is the following,
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome_controller extends CI_Controller {
function __construct(){
parent::__construct();
}
public function index()
{
if(isset($_POST["btn_login"])){
$data = array();
$this->load->model('category_model');
$data['categories'] = $this->category_model->getCategories();
$this->load->view('login_view', $data);
}
else if(isset($_POST["btn_adminpanel"])){
$this->load->view('adminpanel_view');
}
else if(isset($_POST["btn_logout"])){
$this->session->sess_destroy();
$data = array();
$this->load->model('category_model');
$data['categories'] = $this->category_model->getCategories();
$this->load->view('home_view', $data);
}
else if(isset($_POST["btn_read"])){
$this->load->view('readmore_view');
}
}
}
Now I need to redirect the page to readmore_view onClick of the button named 'btn_read', But it doesn't respond. (Note : There are 9 buttons with the same name, and I have tested changing one of them and give the particular name in controller, it didn't work either.) Please suggest me a solution.
<input name="btn_read" class="readbtn" value="Read More" /> There is no input type. You have to mention the type of input.
<input type="submit" name="btn_read" class="readbtn" value="Read More" />

Hidden Form Field - What am I doing wrong?

I am trying to prevent Spam with one of my forms using the Hidden Field trick, but for some reason its not working. When I fill in the field that's supposed to be left empty, the form is submitted like a normal.
Is there something wrong with my php? (I think that's where my problem lies):
This is the code to validate the hidden field (see top of my form):
if(!empty($_POST['email'])){ die('Stop Spamming'); }
Here's the complete php form:
<?
session_start();
include("verification_image.class.php");
$image = new verification_image();
if (($image->validate_code($_POST['validate']) ? "true" : "false") == "false") {
header('Location: http://www.domain.com/fail.htm');
exit;
}
if(!empty($_POST['email'])){ die('Stop Spamming'); }
$to = "email#domain.co.za";
$bcc = "email#domain.co.za";
$from = $_POST['contactemail'];
$subject = "INTERESTED ADVERTISER";
$sbody = '<table width="420" height="135" border="0" align="center"
cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="90" colspan="5"><div align="center">Reservation &
Enquiries Submission Form </div></td>
</tr>
<tr>
<td height="25" colspan="3" align="center" valign="middle"><span
class="style7">Full Name</span></td>
<td width="180" valign="top">'.$_POST['contactname'].'</td>
<td width="42"> </td>
</tr>
<tr>
<td height="25" colspan="3" align="center" valign="middle"><span
class="style7">Contact number</span></td>
<td valign="top">'.$_POST['contactnumber'].'</td>
<td> </td>
</tr>
<tr>
<td height="25" colspan="3" align="center" valign="middle"><span
class="style7">Email</span></td>
<td valign="top">'.$_POST['contactemail'].'</td>
<td> </td>
</tr>
<tr>
<td height="35" colspan="3" align="center" valign="bottom"><span
class="style7">Query</span></td>
<td colspan="2" rowspan="2"
valign="middle">'.$_POST['contactquery'].'</td>
</tr>
<tr>
<td width="84" height="108" align="center" valign="middle">
<!--DWLayoutEmptyCell--> </td>
<td width="69" align="center" valign="middle"><!--DWLayoutEmptyCell-->&
nbsp;</td>
<td width="17"> </td>
</tr>
<tr>
<td height="17"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>';
$sBodyNew = '<style type="text/css">
<!--
.style {
font-family: Arial;
font-size: 12px;
color: #4D241E;
}
body {
background-image: url();
background-color: #F1EAE4;
}
.style1 {font-size: 14px}
-->
</style>
<p> </p>
<table width="420" border="0" align="center" cellpadding="0" cellspacing="5">
<tr>
<td><table width="100%" border="0" cellpadding="8" cellspacing="0" bgcolor="#E7D3AF"
class="style">
<tr>
<td colspan="2" valign="top"><div align="center"><strong><span
class="style1">Website Deal</span><br>
.................................................................</strong><br>
</div></td>
</tr>
<tr>
<td width="32%" valign="top"><div align="left"><strong>Date Submitted</strong>
</div></td>
<td width="68%" valign="top">'. date("F j, Y, g:i a") .'</td>
</tr>
<tr>
<td valign="top"><div align="left"><strong>Name</strong></div></td>
<td valign="top">'.$_POST['contactname'].'</td>
</tr>
<tr>
<td valign="top"><div align="left"><strong>Contact Number</strong></div></td>
<td valign="top">'.$_POST['contactnumber'].'</td>
</tr>
<tr>
<td valign="top"><div align="left"><strong>Email</strong></div></td>
<td valign="top">'.$_POST['contactemail'].'</td>
</tr>
<tr>
<td valign="top"><div align="left"><strong>Query</strong></div></td>
<td valign="top">'.$_POST['contactquery'].'</td>
</tr>
</table></td>
</tr>
</table>
';
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($to, $subject, $sBodyNew, $headers);
header('Location: http://www.domain.com/success.htm');
?>
Heres this is what I added to my HTML form:
<label>
<input type="text" class="email" name="email" id="email" />
</label>
And heres the HTML form:
<form action="process_advertise.php" method="post" name="order"
onSubmit="MM_validateForm('contactname','','R','contactnumber','','R','contactemail',
'','RisEmail','validate','','R','contactquery','','R');return document.MM_returnValue">
<input name="success" type="hidden"
value=http://www.domain.com/success.htm>
<table width="465" border="0" cellspacing="0" cellpadding="0">
<!--DWLayoutTable-->
<tr>
<td width="465" height="387" valign="top"><span class="style66">NAME:
<input name="contactname" type="text" id="contactname" />
</span><br />
<span class="style66">CONTACT NUMBER:</span>
<input name="contactnumber" type="text" id="contactnumber" />
<br />
<span class="style66">EMAIL:
<input name="contactemail" type="text" id="contactemail" />
</span><br />
<span class="style66">QUERY:</span>
<textarea name="contactquery" cols="40" rows="8"
id="contactquery"></textarea>
<br />
<br />
<input type="text" class="email" name="email" id="email" />
<br />
<br />
<img src="picture.php" /><br />
<span class="style57 style16"><em>Please enter character<br />
as listed above</em></span><br />
<input name="validate" type="text" id="validate" />
<br />
<input type="reset" name="button2" id="button2" value="Reset" />
<input type="submit" name="button" id="button" value="Submit" /></td>
</tr>
</table>
</form>
Anyone know what I'm doing wrong?
=======================================================================
Problem Solved:
Ok guys... I've tested the form again and its working now!
I'm not why it didn't work earlier, but for those who like to know... all my coding there is correct except I removed this code from my process php form:
$sbody = '<table width="420" height="135" border="0" align="center"
cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="90" colspan="5"><div align="center">Reservation &
Enquiries Submission Form </div></td>
</tr>
<tr>
<td height="25" colspan="3" align="center" valign="middle"><span
class="style7">Full Name</span></td>
<td width="180" valign="top">'.$_POST['contactname'].'</td>
<td width="42"> </td>
</tr>
<tr>
<td height="25" colspan="3" align="center" valign="middle"><span
class="style7">Contact number</span></td>
<td valign="top">'.$_POST['contactnumber'].'</td>
<td> </td>
</tr>
<tr>
<td height="25" colspan="3" align="center" valign="middle"><span
class="style7">Email</span></td>
<td valign="top">'.$_POST['contactemail'].'</td>
<td> </td>
</tr>
<tr>
<td height="35" colspan="3" align="center" valign="bottom"><span
class="style7">Query</span></td>
<td colspan="2" rowspan="2"
valign="middle">'.$_POST['contactquery'].'</td>
</tr>
<tr>
<td width="84" height="108" align="center" valign="middle">
<!--DWLayoutEmptyCell--> </td>
<td width="69" align="center" valign="middle"><!--DWLayoutEmptyCell-->&
nbsp;</td>
<td width="17"> </td>
</tr>
<tr>
<td height="17"></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>';
This code is not necessary as greg0rie pointed out
There are too many ways your code can be code injected.
You should use filter_var function for a minimal prevent for it.
For validating email use (at least and not just):
if(!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL))
{
echo("E-mail is not valid");
}else{
echo("E-mail is valid");
}
This line of your code seems to be strange:
if (($image->validate_code($_POST['validate']) ? "true" : "false") == "false") {
wouldn't it easier this way?
if (!($image->validate_code($_POST['validate'])){

Why is this script not working? (not getting error, simply posts script and looks like it works)

Below is a contact us script in php, when I click submit at www.mydomain.com.au/contact.html it looks as though it works because I end up at ww.mydomain.com.au/thanks.html.
However the specified email account is not receiving contact emails.
Here is the code for the contact us script found at includes/contact_mail.php
<?php
if(isset($_POST['enter']) && $_POST['enter']==1)
{
$_SESSION['email']=$_POST['email'];
$to="name#domains.com";
$subject='Contact Us Details';
$message="<style>
.textstyle{
font-family:Tahoma;
font-size:11px;
color:#156E00;
text-align:left;
margin-left:10px;
text-decoration:none;
}
</style>";
$message.="<table width=400 border=0>
<tr><td class=textstyle>First Name: </td> <td class=textstyle>".$_POST['fname']."</td></tr>
<tr><td class=textstyle>Last Name: </td> <td class=textstyle>".$_POST['lname']."</td></tr>
<tr><td class=textstyle>E-mail: </td> <td class=textstyle>".$_POST['email']."</td></tr>
<tr><td class=textstyle>Phone Number: </td> <td class=textstyle>".$_POST['tel']."</td></tr>
<tr><td class=textstyle>Comments: </td> <td class=textstyle>".$_POST['que']."</td></tr>
</table>";
$mail_from = "From:".$_POST['email'];
$mail_from .="\r\nContent-type: text/html";
#mail($to,$subject,$message,$mail_from);
header("location: ../thankyou.html");
exit();
}
?>
Here is the code at ww.mydomain.com.au/contact.html
<!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=utf-8" />
<meta name="GENERATOR" content="Macromedia Dreamweaver CS3" />
<meta name="author" content="Relyon security" />
<meta name="keywords" content="Camera Surveillance,Spy Cameras,Remote Viewing,Audio recording,Relyon security" />
<meta name="description" content="" />
<meta http-equiv="EXPIRES" content="-1" />
<title>Relyon Security: About Relyon Security</title>
<link rel="stylesheet" type="text/css" href="css/stylesheet.css" />
<script language="JavaScript" type="text/javascript">
function fullcheck()
{
var str=document.contact.email.value;
//alert(str);
if (document.contact.fname.value=="")
{
alert ("Blank space not allowed. Please type your First Name.");
document.contact.fname.select();
return false;
}
if (document.contact.lname.value=="")
{
alert ("Blank space not allowed. Please type your Last Name.");
document.contact.lname.select();
return false;
}
if ((document.contact.email.value).indexOf(" ")>=0)
{
alert ("Blank space not allowed inside email!");
document.contact.email.select();
return false;
}
if (document.contact.email.value.indexOf("#",1) == -1)
{
alert("Invalid E-Mail address");
document.contact.email.focus();
document.contact.email.select();
return(false);
}
if (document.contact.email.value.indexOf("#") == 0)
{
alert("Invalid E-Mail address");
document.contact.email.focus();
document.contact.email.select();
return(false);
}
if (document.contact.email.value.indexOf(".",5) == -1)
{
alert("Invalid E-Mail address");
document.contact.email.focus();
document.contact.email.select();
return(false);
}
if (document.contact.email.value.indexOf(".") == 0)
{
alert("Invalid E-Mail address");
document.contact.email.focus();
document.contact.email.select();
return(false);
}
if ((document.contact.email.value.lastIndexOf(".")) -(document.contact.email.value.indexOf("#"))<4 )
{
alert("Invalid E-Mail address");
document.contact.email.focus();
document.contact.email.select();
return(false);
}
if (document.contact.tel.value=="")
{
alert ("Blank space not allowed. Please type your Telephone Number.");
document.contact.tel.select();
return false;
}
if (document.contact.que.value=="")
{
alert ("Blank space not allowed. Please enter your question or comment.");
document.contact.que.select();
return false;
}
}
//-->
</script>
</head>
<body>
<table width="1000" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top" align="left" width="110" height="186"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
<td width="780" rowspan="2" align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td height="161" valign="top"><img src="images/spacer.gif" alt="" /></td>
</tr>
<tr>
<td valign="top" align="left" class="btn">
<table width="780" border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td width="10" valign="top"><img src="images/btn-left.jpg" alt="" width="10" height="49" /></td>
<td align="center" valign="middle">
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="154" align="center" valign="top">Home Page</td>
<td width="180" align="center" valign="top">Our Services</td>
<td width="244" align="center" valign="top">About relyon security</td>
<td width="182" align="center" valign="top"><span class="navg_contact_activated">Contact Us</span></td>
</tr>
</table>
</td>
<td width="10" valign="top" align="right"><img src="images/btn-right.jpg" alt="" width="10" height="49" /></td>
</tr>
<tr>
<td colspan="3" height="1" bgcolor="#FFFFFF"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<tr>
<td width="10"><img src="images/left-bot.jpg" alt="" width="10" height="42" /></td>
<td class="shadow"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
<td><img src="images/rgh-bot.jpg" alt="" width="10" height="42" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td valign="top" align="left" width="110"><img src="images/spacer.gif" alt="" /></td>
</tr>
<tr>
<td valign="top" align="left" width="110" bgcolor="#FFFFFF" height="66"><img src="images/spacer.gif" alt="" /></td>
<td valign="top" align="left" width="110" bgcolor="#FFFFFF"><img src="images/spacer.gif" alt="" /></td>
</tr>
</table>
<table width="1000" border="0" cellspacing="0" cellpadding="0" align="center" class="white">
<tr>
<td valign="top" align="left"><table width="780" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top" class="inner_text"><span class="head-blue">Contact Us</span><br /><br />
Email address: relyonsecurity#live.com.au
<br />
Phone: 0422 663 489<br />
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="1000" border="0" cellspacing="0" cellpadding="0" align="center" class="blue">
<tr>
<td valign="top" align="left"><table width="780" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top">
<form name="contact" method="post" action="includes/contact_mail.php" onsubmit="return fullcheck()">
<table width="90%" border="0" cellpadding="0" cellspacing="3" >
<tr>
<td width="7%"> </td>
<td height="30" colspan="2" align="left" valign="middle"><span class="mandatory">*</span>Required fields</td>
</tr>
<tr>
<td> </td>
<td width="22%" class="form_text"><span class="mandatory">*</span>First Name :</td>
<td width="71%"><input name="fname" type="text" id="fname" size="35" class="inputbox"></td>
</tr>
<tr>
<td> </td>
<td width="22%" class="form_text"><span class="mandatory">*</span>Last Name :</td>
<td width="71%"><input name="lname" type="text" id="lname" size="35" class="inputbox"></td>
</tr>
<tr>
<td> </td>
<td class="form_text"><span class="mandatory">*</span>Email Address :</td>
<td><input name="email" type="text" class="inputbox" id="email" size="35"></td>
</tr>
<tr>
<td width="7%"> </td>
<td class="form_text"><span class="mandatory">*</span>Telephone Number:</td>
<td><input name="tel" type="text" class="inputbox" id="tel" size="35"></td>
</tr>
<tr>
<td> </td>
<td class="form_text"><span class="mandatory">*</span>Please enter your question or comment :</td>
<td><textarea name="que" cols="33" rows="8" id="que" class="inputbox"></textarea></td>
</tr>
<tr>
<td colspan="3" height="5" valign="top"><input name="enter" type="hidden" value="1" /></td>
</tr>
<tr>
<td> </td>
<td class="form_text"> </td>
<td><input type="submit" name="Submit" value="Submit" class="inputbox">
<input type="reset" name="Submit2" value="Reset" class="inputbox"></td>
</tr>
<tr>
<td colspan="3" height="30" valign="top"></td>
</tr>
</table>
</form>
<table width="780" border="0" cellspacing="0" cellpadding="0" align="center" class="footer" height="41">
<tr>
<td valign="top" width="12" height="8"><img src="images/foo-l-top.gif" alt="" width="12" height="8" /></td>
<td><img src="images/spacer.gif" alt="" /></td>
<td align="right" valign="top" width="9" height="8"><img src="images/foo-r-top.gif" alt="" width="9" height="8" /></td>
</tr>
<tr>
<td><img src="images/spacer.gif" alt="" /></td>
<td align="center" valign="middle">©2009 Relyon Security.com All Rights Reserved</td>
<td><img src="images/spacer.gif" alt="" /></td>
</tr>
<tr>
<td valign="bottom" height="8"><img src="images/foo-l-bot.gif" alt="" width="12" height="8" /></td>
<td><img src="images/spacer.gif" alt="" /></td>
<td valign="bottom"><img src="images/foo-r-bot.gif" alt="" width="9" height="8" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Second attempt at script?
<?php
error_reporting(E_ALL)
if(isset($_POST['enter']) && $_POST['enter']==1)
{
$_SESSION['email']=$_POST['email'];
$to="name#domains.com";
$subject='Contact Us Details';
$message="<style>
.textstyle{
font-family:Tahoma;
font-size:11px;
color:#156E00;
text-align:left;
margin-left:10px;
text-decoration:none;
}
</style>";
$message.="<table width=400 border=0>
<tr><td class=textstyle>First Name: </td> <td class=textstyle>".$_POST['fname']."</td></tr>
<tr><td class=textstyle>Last Name: </td> <td class=textstyle>".$_POST['lname']."</td></tr>
<tr><td class=textstyle>E-mail: </td> <td class=textstyle>".$_POST['email']."</td></tr>
<tr><td class=textstyle>Phone Number: </td> <td class=textstyle>".$_POST['tel']."</td></tr>
<tr><td class=textstyle>Comments: </td> <td class=textstyle>".$_POST['que']."</td></tr>
</table>";
$mail_from = "From:".$_POST['email'];
$mail_from .="\r\nContent-type: text/html";
mail($to,$subject,$message,$mail_from);
// header("location: ../thankyou.html");
exit();
}
?>
put error_reporting(E_ALL) at the top of the script, remove # from mail() call and comment string with header() and THEN look for errors

Changed server, now my form doesn't work anymore

<form method=post action=index1.php>
<input type=hidden name=active value=1>
<table width="376" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"> </td>
<td align="left" valign="top"><img src="../../images/spacer.gif" width="1" height="25" /></td>
<td align="left" valign="top"><?php
$a=0;
while(list($key, $val) = each($_POST)) {
#print "<br>$val -".strlen($val);
if (strlen($val)>1) {
$a++;
}
}
if ($a <5) {
if (!$active==0) {
print "<b><font color=#ff6600>You probably forgot something.</font></b><br>";
}
?></td>
<td align="left" valign="top"> </td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td align="left" valign="top" bgcolor="#999999"> </td>
<td align="left" valign="top" bgcolor="#999999"> </td>
<td align="left" valign="top"> </td>
</tr>
<tr>
<td width="8" align="left" valign="top"> </td>
<td width="8" align="left" valign="top" bgcolor="#999999"> </td>
<td align="left" valign="top" bgcolor="#999999">Name<br />
<input name=name type=text id="name" value=<?print "\"$name\""?> size=26 maxlength=50></td>
<td width="8" align="left" valign="top"> </td>
</tr>
<tr>
<td width="8" align="left" valign="top"> </td>
<td width="8" align="left" valign="top" bgcolor="#999999"> </td>
<td align="left" valign="top" bgcolor="#999999">E-mail<br />
<input name=email type=text id="email" value=<?print "\"$email\""?> size=26 maxlength=50></td>
<td width="8" align="left" valign="top"> </td>
</tr>
<tr>
<td width="8" align="left" valign="top"> </td>
<td width="8" align="left" valign="top" bgcolor="#999999"> </td>
<td align="left" valign="top" bgcolor="#999999">Subject<br />
<select name="subject">
<option value="[Support] Something else" selected="selected">Please select a subject
<option value="[Support] Custom type(face)">Custom type(face)
<option value="[Support] Technical support">Technical support
<option value="[Support] Licensing">Licensing
<option value="[Support] Ordering help">Ordering help
<option value="[Support] Website comments">Website comments
<option value="[Support] Something else">Something else
</select></td>
<td width="8" align="left" valign="top"> </td>
</tr>
<tr>
<td width="8" align="left" valign="top"> </td>
<td width="8" align="left" valign="top" bgcolor="#999999"> </td>
<td align="left" valign="top" bgcolor="#999999">Message<br />
<textarea name="message" cols="45" rows="12" class="textfield" id="message"></textarea></td>
<td width="8" align="left" valign="top"> </td>
</tr>
<tr>
<td width="8" align="left" valign="top"> </td>
<td width="8" align="left" valign="top" bgcolor="#999999"> </td>
<td align="left" valign="top" bgcolor="#999999">All fields are required.
<br />
<input name="submit" type="submit" value="Submit" />
<?php
} else {
print "<br><b><font color=#ff6600>Thank you! We will come back to you soon.</font></b>";
$body = "Contact form\n\nName: $name\nSubject: $subject\nEmail: $email\nMessage: $message\n";
mail("mail#webzovoort.nl",$subject,$body,"From: $email\r\n");
if ($mailing==1) {
mail("mail#webzovoort.nl",$subject,"","From: $email\r\n");
}
}
?>
<br />
<br /></td>
<td width="8" align="left" valign="top"> </td>
</tr>
</table>
<img src="../../images/various/divider.gif" width="360" height="8" />
</form>
This form was running ok on an other server. But now I moved it doesn't. The form does send an email but it's not filled. It's running on a server with PHP 5.2.12
The first thing is
$HTTP_POST_VARS is deprecated use $_POST instead

Email Div Content

I am trying to email the content of a Div. We have a booking system online and the user selects what options they want, then submit the form. It displays their information on the next page for them to print. I also want a copy of that emailed to them and us.
I liked the look of Jonathon Sampson's email div using ajax script. But it does not work for me. The email always comes back saying 'null' even if I give it a simple Div with one word written in it.
I do not know enough about PHP and have previously used CGI. THe problem with CGI is I cannot style the email. An the problem that I have found with PHP so far is that although I can add HTML to the email I cant decide what I want displayed where, and put returns from peoples forms inside DIVs in the HTML email.
If you take a look at the following page you will get a look at the Booking PAge. This page is where the initial form submission returns its information to. Everything inside the DIV tag 'booking-quote' I want emailed to the user one way or the other. Attached is the 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=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<div align="right" style="padding-top:10px;" id="booking_quote">
<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18" height="30" style="background:url(../../../IMAGES_A/Structure/Headers/blue-corner-piece-left-30px.gif); background-repeat:no-repeat;"> </td>
<td bgcolor="#263D51" style="border-left:1px solid #FFF; border-right:1px solid #FFF; padding-left:5px;"><div align="left" class="Text_normal" style="font-size:13px; color:#FFF;">Customer Records</div></td>
<td width="18" height="30" style="background:url(../../../IMAGES_A/Structure/Headers/blue-corner-piece-right-30px.gif); background-repeat:no-repeat;"> </td>
</tr>
</table></td>
</tr>
<tr>
<td style="padding-top:10px;"><div align="center">
<table width="755" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="500"><div align="left">
<table width="490" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="Corner-Box-WhiteGrey-TL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-T" height="6"></td>
<td class="Corner-Box-WhiteGrey-TR" height="6" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-L" width="6"></td>
<td width="478"><table width="478" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" valign="top"><div align="left" class="Text_normal">
<table width="230" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="77" valign="top" style="padding-right:12px;"><div align="right" style="color:#999;">Name</div></td>
<td width="153" valign="top" style="font-size:13px; line-height:22px; color:#333;"><div align="left"> <?php echo $_POST["CD_first-name"];?> <?php echo $_POST["CD_mid-initial"];?> <?php echo $_POST["CD_surname"];?></div></td>
</tr>
<tr>
<td valign="top" style="padding-right:12px;"><div align="right" style="color:#999;">Address</div></td>
<td valign="top" style="font-size:13px; color:#333;"><div align="left"> <?php echo $_POST["CD_address-L1"];?> <br />
<?php echo $_POST["CD_address-L2"];?> <br />
<?php echo $_POST["CD_address-settlement"];?><br />
<?php echo $_POST["CD_address-county"];?><br />
<?php echo $_POST["CD_address-post-code"];?><br />
<?php echo $_POST["CD_address-country"];?></div></td>
</tr>
</table>
</div></td>
<td width="50%" valign="top"><div align="right" class="Text_normal">
<table width="230" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="77" valign="top" style="padding-right:12px;"><div align="right" style="color:#999;">Date of Birth</div></td>
<td width="153" valign="top" style="font-size:13px; line-height:22px; color:#333;"><div align="left"> <?php echo $_POST["CD_DOB-day"];?>/<?php echo $_POST["CD_DOB-month"];?>/<?php echo $_POST["CD_DOB-year"];?></div></td>
</tr>
<tr>
<td valign="top" style="padding-right:12px;"><div align="right" style="color:#999;">Email</div></td>
<td valign="top" style="font-size:13px; line-height:22px; color:#333;"><div align="left"> <?php echo $_POST["CD_email"];?></div></td>
</tr>
<tr>
<td valign="top" style="padding-right:12px;"><div align="right" style="color:#999;">Telephone</div></td>
<td valign="top" style="font-size:13px; line-height:22px; color:#333;"><div align="left"> <?php echo $_POST["CD_telephone"];?></div></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
<td class="Corner-Box-WhiteGrey-R" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-BL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-B" height="6"></td>
<td class="Corner-Box-WhiteGrey-BR" height="6" width="6"></td>
</tr>
</table>
</div></td>
<td width="255" valign="top"><div align="right">
<table width="250" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="Corner-Box-WhiteGrey-TL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-T" height="6"></td>
<td class="Corner-Box-WhiteGrey-TR" height="6" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-L" width="6"></td>
<td><div align="center" class="Text_normal">
<table width="230" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" style="padding-right:12px;"><div align="left" style="color:#999;">Highest Current Qualifiacation</div></td>
</tr>
<tr>
<td valign="top" style="font-size:13px; line-height:22px; color:#333;"><div align="left"> <?php echo $_POST["CD_experience-qualifications"];?></div></td>
</tr>
<tr>
<td width="230" valign="top" style="padding-right:12px; padding-top:5px;"><div align="left" style="color:#999;">Total Logged Dives to Date</div></td>
</tr>
<tr>
<td valign="top" style="font-size:13px; line-height:22px; color:#333;"><div align="left"> <?php echo $_POST["CD_experience-dives"];?></div></td>
</tr>
</table>
</div></td>
<td class="Corner-Box-WhiteGrey-R" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-BL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-B" height="6"></td>
<td class="Corner-Box-WhiteGrey-BR" height="6" width="6"></td>
</tr>
</table>
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
<br />
<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18" height="30" style="background:url(../../../IMAGES_A/Structure/Headers/blue-corner-piece-left-30px.gif); background-repeat:no-repeat;"> </td>
<td bgcolor="#263D51" style="border-left:1px solid #FFF; border-right:1px solid #FFF; padding-left:5px;"><div align="left" class="Text_normal" style="font-size:13px; color:#FFF;">Details</div></td>
<td width="18" height="30" style="background:url(../../../IMAGES_A/Structure/Headers/blue-corner-piece-right-30px.gif); background-repeat:no-repeat;"> </td>
</tr>
</table></td>
</tr>
<tr>
<td style="padding-top:10px;"><div align="center">
<table width="755" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="575"><div align="left" class="Text_normal">
<table width="565" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="Corner-Box-WhiteGrey-TL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-T" height="6"></td>
<td class="Corner-Box-WhiteGrey-TR" height="6" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-L" width="6"></td>
<td width="553"><table width="553" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="428" valign="top" style="padding-bottom:3px; border-bottom:1px solid #CCC;"><div align="left" class="Text_Sub_Title"><?php echo $_POST["programme"];?></div></td>
<td width="125" valign="top" style="padding-bottom:3px; border-bottom:1px solid #CCC;"><div align="right" class="Text_Sub_Title" style="color:#333;">£<?php echo $_POST["Prog_total"];?></div></td>
</tr>
<tr>
<td colspan="2" valign="top" style="padding-top:3px;"><ul>
<div><?php echo $_POST["Prog_Sum_Sub_Open_Water_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Open_Water_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Refresh_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Refresh_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Advanced_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dives_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Safari_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Safari_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_2"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_3"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_4"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_5"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_6"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_7"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Discover_Safari_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Discover_Safari_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Equipment_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Accommodation_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Accommodation_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Accommodation_01_2"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Accommodation_01_3"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_PADI_Materials_Fees_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_PADI_Materials_Fees_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Transfers_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Transfers_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Transfers_01_2"];?></div>
</ul></td>
</tr>
</table></td>
<td class="Corner-Box-WhiteGrey-R" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-BL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-B" height="6"></td>
<td class="Corner-Box-WhiteGrey-BR" height="6" width="6"></td>
</tr>
</table>
<br />
<table width="565" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="Corner-Box-WhiteGrey-TL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-T" height="6"></td>
<td class="Corner-Box-WhiteGrey-TR" height="6" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-L" width="6"></td>
<td width="553"><table width="553" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="428" valign="top"><div align="left" class="Text_Sub_Title"><?php echo $_POST["Store_Dive_The_Gap_Equipment_Package"];?></div></td>
<td width="125" valign="top"><div align="right" class="Text_Sub_Title" style="color:#333;"><?php echo $_POST["Store_Dive_The_Gap_Equipment_Package_total"];?></div></td>
</tr>
<tr>
<td colspan="2" valign="top" style="padding-top:3px;"><ul>
<div>
<div><?php echo $_POST["Store_Dive_The_Gap_Equipment_Package_details"];?></div>
</div>
</ul></td>
</tr>
</table></td>
<td class="Corner-Box-WhiteGrey-R" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-BL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-B" height="6"></td>
<td class="Corner-Box-WhiteGrey-BR" height="6" width="6"></td>
</tr>
</table>
</div></td>
<td width="180" valign="top"><div align="right">
<table width="170" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6" colspan="3" valign="middle" class="Text_normal" style="background:url(../../../IMAGES_A/Structure/Headers/blue-Semicircle-170px.jpg); height:25px;"><div align="left" style="padding-left:20px; padding-top:4px; color:#FFF; font-size:13px; font-weight:bold;">Summary</div></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-L" width="6"></td>
<td width="158" bgcolor="#FFF"><div align="center" class="Text_normal" style="font-size:18px; color:#333; padding-top:12px; padding-bottom:12px; border-bottom:1px solid #CCC;">£<?php echo $_POST["Basket_Total"];?><span style="font-size:13px; color:#666; padding-left:4px;">incl. VAT</span></div>
<div align="center" class="Text_normal" style="font-size:12px; color:#666; padding-top:12px; padding-bottom:12px;"> <?php echo $_POST["Basket-Total-Duration-Text"];?><br />
<span style="font-size:10px; color:#666; padding-left:4px;">incl. arrival and departure day</span></div></td>
<td class="Corner-Box-WhiteGrey-R" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-BL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-B" height="6"></td>
<td class="Corner-Box-WhiteGrey-BR" height="6" width="6"></td>
</tr>
</table>
<br />
<table width="170" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6" colspan="3" valign="middle" class="Text_normal" style="background:url(../../../IMAGES_A/Structure/Headers/blue-Semicircle-170px.jpg); height:25px;"><div align="left" style="padding-left:20px; padding-top:4px; color:#FFF; font-size:13px; font-weight:bold;">Start Date</div></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-L" width="6"></td>
<td width="158" bgcolor="#FFF"><div align="left" class="Text_basic" style="padding-top:12px; padding-bottom:12px;">
<div align="center"><span style="font-size:14px; color:#666; padding-left:10px;" align="left" id="Prog-Start-Date-Text"></span><span class="Text_normal" style="font-size:12px; color:#666; padding-top:12px; padding-bottom:12px;"><?php echo $_POST["Prog_start-date"];?></span></div>
</div></td>
<td class="Corner-Box-WhiteGrey-R" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-BL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-B" height="6"></td>
<td class="Corner-Box-WhiteGrey-BR" height="6" width="6"></td>
</tr>
</table>
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
<br />
</div>
</body>
</html>
You have the id of the div as "booking_quote" in the HTML, not "booking-quote". Make sure you're using "booking-quote" in all places. Since you didn't attach the JavaScript code, it's hard to see what's going on, but the easiest thing would be to
Put a form tag on your page. Give it an id of "my-form" or whatever.
attach an event to your form's submit method
in the method, take the contents of the div and put them into a hidden form field
Using jQuery, it would be something like:
$('form#my-form').submit(function()
{
$('input#my-hidden-field').val($('div#booking-quote').text())
});
It sounds like you have magic quotes turned on in your PHP setup. Try wrapping your $message variable in stripslashes.

Categories