Page 1 of 1

using db to save email code

Posted: Mon Jun 28, 2010 7:56 pm
by nite4000
Hey

I have a problem and need some help

I have a section in my admin panel where the content of a email that is sent out to the user when they join can be modified.

HERE is what is in my page

Code: Select all

$to =  $_POST['email'];  
$subject = 'Account Information';

// message
$message = '
<html>
  <head>
    <title>Account Details</title>
    <style type="text/css">
    <!--
    
    body {
      margin: 0;
      padding: 0;
      border: 1px solid #ccc;
      width: 750px;
      margin: 0 auto;
      font-family: "trebuchet ms", tahoma, arial, helvetica, sans-serif;
      color: #797979;
    }
    
    h2, th {
      color: #7ac77a;
    }
    
    th {
      text-align: left;
      border-bottom: 1px solid #f0f0f0;
      border-left: 1px solid #f0f0f0;
      border-right: 1px solid #f0f0f0;
      padding-bottom: 1em;
      background-color: #F3F9FF;
    }
    
    table {
      border: 1px dashed #ccc;
      background: #fff;
    }
    
    td {
      font-size: .9em;
      color: #333;
      margin: .4em;
    }
    
    .info {
      color: #0779EB;
    }
    
    #body_area {
      background-color: #fff;
      padding: 1em;
    }
    
    p {
      font-family: tahoma, arial, helvetica, sans-serif;
      font-weight: normal;
      color: #333;
      font-size: .9em;
    }
    
    a:link, a:visited {
      color: #0779EB;
      text-decoration: none;
      font-weight: bold;
    }
    
    a:hover {
      color: #3399FF;
      text-decoration: underline;
    }
    
    img {
      border: none;
      border-bottom: 2px solid #3399FF;
    }
    
    -->
    </style>
  </head>
  <body>
    <div>
   
    </div>
    
    <div id="body_area">
     
      
  [b]    <table width="95%">
        <tr>
          <th colspan="2">
            Account Details
          </th>
        </tr>
        <tr>
          
          <td class="info">
          Dear  ' . $_POST['first'] . ' ' . $_POST['last'] . ' ,
		  <br />
	Here is your account information. Be sure to keep this in a secure place.<br />
<br />
<br />

Your Login Information :<br />
<br />
Username :  '.$user.'<br />

Password : ******(hidden for security)<br />
<br />
Pin Code : '.$_POST['pin'].' - used for deposits and withdrawals and account updates
<br />
<br />
If you have any questions of concerns please contact support.
          </td>
        </tr>
             </table>[/b]              </div>
</body>
</html>
';


// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From:'.$gen['admin_email']."\n".'<'.$gen['site_name'].'>'."\n";

// Mail it
mail($to, $subject, $message, $headers);
the part i put inn od is what i have in the database and o iin that place i hve this

Code: Select all

$temp['register'];

however when the email is senni get the email but it shows the code in the email like instead of a name it will show $_POST['first']; and so on

Any help would be nice.

Re: using db to save email code

Posted: Mon Jun 28, 2010 8:04 pm
by eruna
I don't see what is is causing this, but you can try creating variables first: $name=$_POST['name'];
Then put the message in double quotes and put in the variable.

"
Dear $name,
etc..

";

Re: using db to save email code

Posted: Tue Jun 29, 2010 6:23 am
by nite4000
when the code is in the database its not picking up the info from the form on what to show like instead of showing $_POST['first'] it should so what was entered. but its not

Re: using db to save email code

Posted: Tue Jun 29, 2010 6:37 am
by internet-solution
nite4000 wrote:when the code is in the database its not picking up the info from the form on what to show like instead of showing $_POST['first'] it should so what was entered. but its not
The code you posted in your first post, does not show any interaction with database or your form code. Care to explain a bit more on what you want to do? What is stored in the databse?

Re: using db to save email code

Posted: Tue Jun 29, 2010 6:47 am
by nite4000
ok The code thats in the database is the email code like the table that holds the info for the email and when i mean table i mean a html table.

On the register page is where all the code is to connect to the database.

What I am trying to do is allow the email code thats in the database to be altered in a panel.

I dont always include my db connection code when i post on here