Jump to content

PHP EMAIL, script is working but I have one problem


plodos

Recommended Posts

I have a problem like that email script is working but not correctly...

 

Problem is mixing the HTML codes and form informations..I upload the OUTPUT of the email...

http://img405.imageshack.us/img405/9733/testrs6.jpg

Did u check the link?..Bad codes, must be clear user interface :S

 

I used two different methods, I didnt understand the mistake???

 

METHOD 1

<?php

$fullname = $_REQUEST["fullname"];
$country = $_REQUEST["country"];
$institution = $_REQUEST["institution"];
$subject = $_REQUEST["subject"];
$message = $_REQUEST["message"];
$from = $_REQUEST["from"];
$verif_box = $_REQUEST["verif_box"];

$now = time();
$date = date("d/m/Y H:i:s",$now);

$content ='
<table width="522" height="235" border="1">
<tbody>
   <tr>
    <td width="506" height="23" bgcolor="#FFFFFF" colspan="2">
    <center>ONLINE FORM </center> <br>
    Date : '.$date.'             IP Adress :'.$_SERVER['REMOTE_ADDR'].'
    </td>
  </tr>

  <tr>
    <td width="105" height="23" bgcolor="#CCCCCC">Full Name </td>
    <td width="403" bgcolor="#CCCCCC">'.$fullname.'</td>
  </tr>
  <tr>
    <td height="23" valign="top">Institution</td>
    <td>'.$institution.'</td>
  </tr>
  <tr>
    <td bgcolor="#CCCCCC">Country</td>
    <td bgcolor="#CCCCCC">'.$country.'</td>
  </tr>
  <tr>
    <td height="29">From</td>
    <td>'.$from.'</td>
  </tr>
  <tr>
    <td height="25" bgcolor="#CCCCCC">Comments</td>
    <td bgcolor="#CCCCCC">'.$message.'</td>
  </tr>
  </tbody>
</table>';

$headers .= ONLINE FORM <$from>\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-9' . "\n";


if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
    mail("[email protected]", 'ONLINE FORM: '.$subject,$content,$headers);
    setcookie('tntcon','');
} else {
    header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&fullname=$fullname&country=$country&institution=&institution& from=$from&message=$message&wrong_code=true");
    exit;
}   
?>
<!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>E-Mail Sent</title>
<style type="text/css">
<!--
body,td,th {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
}
-->
</style></head>

<body>
Email sent. Thank you.<br />
<br />
Return to <a href="/">home page</a> ? 
</body>
</html>


METHOD 2



<?php

$fullname = $_REQUEST["fullname"];
$country = $_REQUEST["country"];
$institution = $_REQUEST["institution"];
$subject = $_REQUEST["subject"];
$message = $_REQUEST["message"];
$from = $_REQUEST["from"];
$verif_box = $_REQUEST["verif_box"];

$now = time();
$date = date("d/m/Y H:i:s",$now);
$ip = $_SERVER['REMOTE_ADDR'];

$content ="<table width=522 height=235 border=1>";
$content .="<tbody><tr><td width=506 height=23 bgcolor=#FFFFFF colspan=2>";
$content .="<center>ONLINE FORM </center> <br>";
$content .="Date : $date             IP Adress :$ip";
$content .="</td></tr>";
$content .="<tr><td width=105 height=23 bgcolor=#CCCCCC>Full Name </td>";
$content .="<td width=403 bgcolor=#CCCCCC>$fullname</td></tr>";
$content .="<tr><td height=23 valign=top>Institution</td>";
$content .="<td>$institution</td></tr>";
$content .="<tr><td bgcolor=#CCCCCC>Country</td>";
$content .="<td bgcolor=#CCCCCC>$country</td></tr>";
$content .="<tr><td height=29>From</td>";
$content .="<td>$from</td></tr>";
$content .="<tr>";
$content .="<td height=25 bgcolor=#CCCCCC>Comments</td>";
$content .="<td bgcolor=#CCCCCC>$message</td>";
$content .="</tr>";
$content .="</tbody>";
$content .="</table>";


$headers = "ONLINE FORM <$from>\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-9' . "\n";


if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
    mail("[email protected]", 'ONLINE FORM: '.$subject,$content,$headers);
    setcookie('tntcon','');
} else {
    header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&fullname=$fullname&country=$country&institution=&institution& from=$from&message=$message&wrong_code=true");
    exit;
}   
?>
<!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>E-Mail Sent</title>
<style type="text/css">
<!--
body,td,th {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
}
-->
</style></head>

<body>
Email sent. Thank you.<br />
<br />
Return to <a href="/">home page</a> ? 
</body>
</html>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.