I am doing simple PHP form validation with email template. I am having simple form called "index.html" and having submit button with form method "post" and action as "sendmail.php". In my sendmail.php, am having smtp-mailer.php with email template called as "email-template.html". How can i pass a variable from index.html to mail-template.php via sendmail.php... Catch my point??? I know about using SESSION. But i don't know where should i call this and how to fetch this??? Any idea...???
index.html
<form method="post" action="sendemail.php">
Email: <input name="email" id="email" type="text" /><br />
Message:<br />
<textarea name="message" id="message" rows="15" cols="40"></textarea><br />
<input type="submit" value="Submit" />
</form>
sendmail.php
<?php
include "class.smtp.php";
include "class.phpmailer.php";
session_start();
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$_SESSION['message'] = $message;
$Body = file_get_contents('email-template.php');
...
...
?>
email-template.php (send it to email not in browser)
<table border="1">
<tr>
<td colspan="2">
<h3>
<?php
session_start();
$message = $_SESSION['message'];
echo "Your registration is: ".$message.".";
?>
</h3>
</td>
</tr>
</table>
Updates : I did the same... But no response... Did i miss something in sendmail.php
.htmlfiles as PHP, you will need to renamed email-template.html to email-template.php - that file won't get parsed properly<?php error_reporting(E_ALL); ini_set('display_errors', 1);then the rest of your code, to see if it yields anything.