Jump to content

How can you post a variable which is a HTML email?


ActaNonVerba1

Recommended Posts

Hey guys.

 

This is my code:

<?php
session_start();
if ($_SESSION['adminlogin'] == 1){
	//Run
}
else {
header('Location: Log-In.php');
exit;
}
?>
<!DOCTYPE HTML>
<html lang="en-GB">
<head>
            <meta charset="utf-8">
            <!--Search Engine Meta Tags--> 
            <meta name="author" content="Worldwide Lighthouses">
            <meta name="keywords" content="Lighthouses,Lightships,Trinity House,Fog Signals,Fog Horns,Fresnel">
            <meta name="description" content="Worldwide Lighthouses is the number 1 source of information, pictures and videos on the Subject of Lighthouses and Lightships">
            <!--Stylesheets/Javascript-->
            <link rel="stylesheet" href="../../Page-Layout.css" media="screen and (min-width: 481px)">
            <link rel="stylesheet" href="../../Mobile-Page-Layout.css" media="only screen and (max-width:480px)">
            <!--Mobile Browser Support-->
            <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
            <!--IE Support-->
            <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link rel="stylesheet" href="../Page-Layout.css"><![endif]-->
<meta name="application-name" content="Worldwide Lighthouses"> 
	<meta name="msapplication-starturl" content="http://worldwidelighthouses.com/"> 
        	<meta name="msapplication-tooltip" content="Worldwide Lighthouses: Your number one source of Lighthouse Information, Videos and Pictures"> 
        	<meta name="msapplication-task" content="name=Lighthouses;action-uri=http://worldwidelighthouses.com/Lighthouses.php;icon-uri=http://worldwidelighthouses.com/IE9/Lighthouses.ico"> 
        	<meta name="msapplication-task" content="name=Lightships;action-uri=http://worldwidelighthouses.com/Lightships.php;icon-uri=http://worldwidelighthouses.com/IE9/Lightships.ico"> 
	<meta name="msapplication-task" content="name=Fog Signals;action-uri=http://worldwidelighthouses.com/Fog-Signals.php;icon-uri=http://worldwidelighthouses.com/IE9/Fog-Signals.ico"> 
       		<meta name="msapplication-task" content="name=Glossary;action-uri=http://worldwidelighthouses.com/Glossary.php;icon-uri=http://worldwidelighthouses.com/IE9/Glossary.ico">
            	<title>Mailing List Administration | Worldwide Lighthouses</title> 
            </head>
<body>
  <header>
	<h1 id="WWLH">Worldwide Lighthouses</h1>
	<form method="get" action="http://www.worldwidelighthouses.com/Search/search.php" id="Search-Box">
		<input type="search" placeholder="Search Worldwide Lighthouses" name="query" id="query" size="30" value="" autocomplete="off">	
		<input type="submit" value="Search">
           		<input type="hidden" name="search" value="1"> 
  		</form>
</header> 	<nav>
  		<ul id="Nav">
		<li class="MenuButton" id="Index"><a href="http://www.worldwidelighthouses.com/Index.php"><p class="Nav">Home</p></a></li>
       		<li class="MenuButton" id="Lighthouses"><a href="http://www.worldwidelighthouses.com/Lighthouses.php"><p class="Nav">Lighthouses</p></a></li>
       		<li class="MenuButton" id="Lightships"><a href="http://www.worldwidelighthouses.com/Lightships.php"><p class="Nav">Lightships</p></a></li>
       		<li class="MenuButton" id="FogSignals"><a href="http://www.worldwidelighthouses.com/Fog-Signals.php"><p class="Nav">Fog Signals</p></a></li>
            <li class="MenuButton" id="Daymarks"><a href="http://www.worldwidelighthouses.com/Daymarks.php"><p class="Nav">Daymarks</p></a></li>
            <li class="MenuButton" id="Buoys"><a href="http://www.worldwidelighthouses.com/Buoys.php"><p class="Nav">Buoys</p></a></li>
       		<li id="MenuButtonLast"><a href="http://www.worldwidelighthouses.com/Glossary.php"><p class="Nav">Glossary</p></a></li>
	</ul>
</nav>
        <?php
	if ($_SESSION['adminlogin']==1) {
		echo '<div id="logout">
			  <div style="float:left; width:30%; text-align:left;!important">
			  <a href="Log-In-Accept-Deny.php">Back to Admin Home</a>
			  </div>
			  <div style="float:right; width:70%;">
			  <a href="Logout.php">Log Out of Admin</a>
			  <p style="font-size:10px;">Always Sign Out when Finished!</p>
			  </div></div>';}
?> 
    <article>
<?php
$title = $_POST['title'];

$introparagraph = $_POST['introparagraph'];

$update1title = $_POST['update1title'];
$update2title = $_POST['update2title'];
$update3title = $_POST['update3title'];

$update1caption = $_POST['update1caption'];
$update2caption = $_POST['update2caption'];
$update3caption = $_POST['update3caption'];

$update1link = $_POST['update1link'];
$update2link = $_POST['update2link'];
$update3link = $_POST['update3link'];

$maincontenttitle = $_POST['maincontenttitle'];
$article = $_POST['article'];
$articlelink = $_POST['articlelink'];

#################################################################
#####################IMAGE UPLOAD SCRIPT#########################
#################################################################


// Where the mainimage file is going to be placed
$target_path_mainimage = "Newsletter-Images/Main-Images/";
// Wheere the update images will be places
$target_path_updateimage1 = "Newsletter-Images/Update-Images/1/";
$target_path_updateimage2 = "Newsletter-Images/Update-Images/2/";
$target_path_updateimage3 = "Newsletter-Images/Update-Images/3/";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
//Main
$target_path_mainimage = $target_path_mainimage . basename( $_FILES['mainimage']['name']); 
//Update Images
$target_path_updateimage1 = $target_path_updateimage1 . basename( $_FILES['update1']['name']); 
$target_path_updateimage2 = $target_path_updateimage2 . basename( $_FILES['update2']['name']); 
$target_path_updateimage3 = $target_path_updateimage3 . basename( $_FILES['update3']['name']); 

//Move the main image file to its location
if(move_uploaded_file($_FILES['mainimage']['tmp_name'], $target_path_mainimage)) {
} else{
    echo "There was an error uploading the main image file, please try again!";
}
//Move the update images to their location
if(move_uploaded_file($_FILES['update1']['tmp_name'], $target_path_updateimage1)) {
} else{
    echo "There was an error uploading the 1st update image file, please try again!";
}

if(move_uploaded_file($_FILES['update2']['tmp_name'], $target_path_updateimage2)) {
} else{
    echo "There was an error uploading the 2nd update image file, please try again!";
}

if(move_uploaded_file($_FILES['update3']['tmp_name'], $target_path_updateimage3)) {
} else{
    echo "There was an error uploading the 3rd update image file, please try again!";
}
##############################################################################
######################### END IMAGE UPLOAD SCRIPT ############################
##############################################################################
$mainimageurl = "http://www.worldwidelighthouses.com/Newsletter/Admin/Newsletter-Images/Main-Images/".basename( $_FILES['mainimage']['name']);
$update1imageurl = "http://www.worldwidelighthouses.com/Newsletter/Admin/Newsletter-Images/Update-Images/1/".basename( $_FILES['update1']['name']);
$update2imageurl = "http://www.worldwidelighthouses.com/Newsletter/Admin/Newsletter-Images/Update-Images/2/".basename( $_FILES['update2']['name']);
$update3imageurl = "http://www.worldwidelighthouses.com/Newsletter/Admin/Newsletter-Images/Update-Images/3/".basename( $_FILES['update3']['name']);

$emailcontent = '
<html> 
<head> 
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
   <title>'.$title.'</title> 
</head> 
<body style="margin: 0; padding: 0;"> 

<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#333333"><tr><td> 
<table cellspacing="15" id="main" align="center" width="600" cellpadding="0" bgcolor="ffffff" style="margin-top: 10px; border: 1px solid #cfcece;"> 
	<tr> 
		<td> 
			<table id="header" cellpadding="10" cellspacing="0" align="center" bgcolor="#000000"> 
				<tr> 
					<td width="570" bgcolor="#356A5C"><a href="http://www.worldwidelighthouses.com" style="color: #FFF; text-decoration: none;"><h1 style="font-size: 24px; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; margin: 0; color: #ffffff; padding: 0;">Worldwide Lighthouses</h1></a><h2 style="font-size: 24px; font-family: Arial, Helvetica, sans-serif; margin: 0; color: #ffffff !important; padding: 0;">'.$title.'</h2></td> 
				</tr> 
				<tr> 
					<td width="570" align="right" bgcolor="#154A3C"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #ffffff; margin: 0; padding: 0;">'.date("F Y").'</p></td> 
				</tr> 
			</table><!-- header --> 
		</td> 
	</tr><!-- header --> 

	<tr> 
		<td></td> 
	</tr> 
	<tr> 
		<td> 
			<table id="content-1" cellpadding="0" cellspacing="0" align="center"> 
                
			</table>
			<img src="'.$mainimageurl.'" height="190" alt="'.$title.'" width="570" style="display: block;" /><!-- content 1 --> 
		</td> 
	</tr><!-- content 1 --> 
	<tr> 
		<td> 
			<table id="content-2" cellpadding="0" cellspacing="0" align="center"> 
				<tr> 
					<td width="570"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode',".' sans-serif; color: #444444; margin: 0; padding: 0;">'.$introparagraph.'</p></td> 
				</tr> 
			</table><!-- content-2 --> 
		</td> 
	</tr><!-- content-2 --> 
	<tr> 
		<td> 
			<table id="content-3" cellpadding="0" cellspacing="0" align="center"> 
				<tr> 
					<td valign="top" width="170" bgcolor="d0d0d0" style="padding: 5px;"> 
						<a href="'.$update1link.'" style="color: #FFF; text-decoration: none;"><img src="'.$update1imageurl.'" alt="'.$update1title.'" style="display: block;" /></a>
					</td> 
					<td width="15"></td> 
					<td valign="top" width="170" bgcolor="d0d0d0" style="padding: 5px;"> 
						<a href="'.$update2link.'" style="color: #FFF; text-decoration: none;"><img src="'.$update2imageurl.'" alt="'.$update2title.'" style="display: block;" /></a>
					</td> 
					<td width="15"></td> 
					<td valign="top" width="170" bgcolor="d0d0d0" style="padding: 5px;"> 
						<a href="'.$update3link.'" style="color: #FFF; text-decoration: none;"><img src="'.$update3imageurl.'" alt="'.$update3title.'" style="display: block;" /></a> 
					</td> 
				</tr> 
			</table><!-- content-3 --> 
		</td> 
	</tr><!-- content-3 --> 
	<tr> 
		<td> 
			<table id="content-4" cellpadding="0" cellspacing="0" align="center"> 
				<tr> 
					<td width="180" valign="top"> 
						<a href="'.$update1link.'" style="color: #FFF; text-decoration: none;"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444;">'.$update1title.'</h5></a> 
						<a href="'.$update1link.'" style="color: #FFF; text-decoration: none;"><p style="font-size: 12px; line-height: 1.5; font-family:'." 'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$update1caption.'</p></a>
					</td> 
					<td width="15"></td> 
					<td width="180" valign="top"> 
						<a href="'.$update2link.'" style="color: #FFF; text-decoration: none;"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444;">'.$update2title.'</h5></a>
						<a href="'.$update2link.'" style="color: #FFF; text-decoration: none;"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$update2caption.'</p></a>
					</td> 
					<td width="15"></td> 
					<td width="180" valign="top"> 
						<a href="'.$update3link.'" style="color: #FFF; text-decoration: none;"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444;">'.$update3title.'</h5></a>
						<a href="'.$update3link.'" style="color: #FFF; text-decoration: none;"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$update3caption.'</p></a>
					</td> 
				</tr> 
			</table><!-- content-4 --> 
		</td> 
	</tr><!-- content-4 -->  
	</tr><!-- content-5 --> 
	<td>
	<tr bgcolor="#FFFFFF" align="center"> 
		<a href="'.$articlelink.'" style="color: #FFF; text-decoration: none;"><td height="30"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444 !important; text-align:left;">'.$maincontenttitle.'</h5></a></td> 
	</tr> 
	<tr> 
		<td> 
			<table id="content-6" cellpadding="0" cellspacing="0" align="center" bgcolor="#FFFFFF"> 
				<p align="left" style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$article.'</p> 
				<p align="center" style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;"><a href="http://www.worldwidelighthouses.com" style="text-decoration: none; color: #4A72AF;">Visit the website now!</a></p> 
			</table> 
		</td> 
	</tr> 

</table><!-- main --> 
<table id="bottom-message" cellpadding="20" cellspacing="0" width="600" align="center"> 
	<tr> 
		<td align="center"> 
			<p style="font-size: 12px; line-height: 1.5; font-family: Arial, Helvetica, sans-serif; color: #444444; margin: 0; padding: 0;">You are receiving this email because you signed up for updates</p> 
			<p style="font-size: 12px; line-height: 1.5; font-family: Arial, Helvetica, sans-serif; color: #444444; margin: 0; padding: 0;"><a href="mailto:dantonybrown@hotmail.co.uk?subject=Unsubscribe%20Me&body=Please%20unsubscribe%20me%20from%20your%20mailing%20list" style="text-decoration: none; color: #4A72AF;">Unsubscribe instantly</a>
		</td> 
	</tr> 
</table><!-- top message --> 
</td></tr></table><!-- wrapper --> 

</body> 
</html>
';

echo '<div class="Textbox"><h2>Email Preview:</h2>';
echo '<p>If you are happy with the below preview (note: Make sure you check all links work and spelling is correct before sending) then click te button below</p>';
?>
<form action="Send-Email.php" method="post">
<input type="hidden" value="<?php $emailcontent?>" name="emailcontent">
<input type="submit" value="Send Email to Entire Contact List">
</form>
</div>
<?php echo $emailcontent;?>
</article>
<footer>
    <ul>
	<li><a href="http://www.worldwidelighthouses.com/About.php">About</a></li>
        <li><a href="http://www.worldwidelighthouses.com/Contact-us.php">Contact</a></li>
        <li><a href="http://www.worldwidelighthouses.com/Use-Our-Media.php">Use our media</a></li>
        <li><a href="http://www.worldwidelighthouses.com/Search/search.php">Search</a></li>
        <li><a href="http://www.worldwidelighthouses.com/Social-Networking.php">Social</a></li>
        <li><a href="#Top">Back to top</a></li>
    </ul>
    <br>
    <br>
    	&#169; Worldwide Lighthouses <?php echo date("Y"); ?>
</footer>
</body>

 

Essentially what im trying to do is create and display a preview of an automatically generated email (which works) then i want the email (all of whoms code is contained in $emailcontent to be posted to the next page where it will actually send. However this does not seem to work.

 

any advice?

 

Thanks.

Danny

 

Link to comment
Share on other sites

the bit of particular interest is

$emailcontent = '
<html> 
<head> 
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
   <title>'.$title.'</title> 
</head> 
<body style="margin: 0; padding: 0;"> 

<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#333333"><tr><td> 
<table cellspacing="15" id="main" align="center" width="600" cellpadding="0" bgcolor="ffffff" style="margin-top: 10px; border: 1px solid #cfcece;"> 
	<tr> 
		<td> 
			<table id="header" cellpadding="10" cellspacing="0" align="center" bgcolor="#000000"> 
				<tr> 
					<td width="570" bgcolor="#356A5C"><a href="http://www.worldwidelighthouses.com" style="color: #FFF; text-decoration: none;"><h1 style="font-size: 24px; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; margin: 0; color: #ffffff; padding: 0;">Worldwide Lighthouses</h1></a><h2 style="font-size: 24px; font-family: Arial, Helvetica, sans-serif; margin: 0; color: #ffffff !important; padding: 0;">'.$title.'</h2></td> 
				</tr> 
				<tr> 
					<td width="570" align="right" bgcolor="#154A3C"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #ffffff; margin: 0; padding: 0;">'.date("F Y").'</p></td> 
				</tr> 
			</table><!-- header --> 
		</td> 
	</tr><!-- header --> 

	<tr> 
		<td></td> 
	</tr> 
	<tr> 
		<td> 
			<table id="content-1" cellpadding="0" cellspacing="0" align="center"> 
                
			</table>
			<img src="'.$mainimageurl.'" height="190" alt="'.$title.'" width="570" style="display: block;" /><!-- content 1 --> 
		</td> 
	</tr><!-- content 1 --> 
	<tr> 
		<td> 
			<table id="content-2" cellpadding="0" cellspacing="0" align="center"> 
				<tr> 
					<td width="570"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode',".' sans-serif; color: #444444; margin: 0; padding: 0;">'.$introparagraph.'</p></td> 
				</tr> 
			</table><!-- content-2 --> 
		</td> 
	</tr><!-- content-2 --> 
	<tr> 
		<td> 
			<table id="content-3" cellpadding="0" cellspacing="0" align="center"> 
				<tr> 
					<td valign="top" width="170" bgcolor="d0d0d0" style="padding: 5px;"> 
						<a href="'.$update1link.'" style="color: #FFF; text-decoration: none;"><img src="'.$update1imageurl.'" alt="'.$update1title.'" style="display: block;" /></a>
					</td> 
					<td width="15"></td> 
					<td valign="top" width="170" bgcolor="d0d0d0" style="padding: 5px;"> 
						<a href="'.$update2link.'" style="color: #FFF; text-decoration: none;"><img src="'.$update2imageurl.'" alt="'.$update2title.'" style="display: block;" /></a>
					</td> 
					<td width="15"></td> 
					<td valign="top" width="170" bgcolor="d0d0d0" style="padding: 5px;"> 
						<a href="'.$update3link.'" style="color: #FFF; text-decoration: none;"><img src="'.$update3imageurl.'" alt="'.$update3title.'" style="display: block;" /></a> 
					</td> 
				</tr> 
			</table><!-- content-3 --> 
		</td> 
	</tr><!-- content-3 --> 
	<tr> 
		<td> 
			<table id="content-4" cellpadding="0" cellspacing="0" align="center"> 
				<tr> 
					<td width="180" valign="top"> 
						<a href="'.$update1link.'" style="color: #FFF; text-decoration: none;"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444;">'.$update1title.'</h5></a> 
						<a href="'.$update1link.'" style="color: #FFF; text-decoration: none;"><p style="font-size: 12px; line-height: 1.5; font-family:'." 'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$update1caption.'</p></a>
					</td> 
					<td width="15"></td> 
					<td width="180" valign="top"> 
						<a href="'.$update2link.'" style="color: #FFF; text-decoration: none;"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444;">'.$update2title.'</h5></a>
						<a href="'.$update2link.'" style="color: #FFF; text-decoration: none;"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$update2caption.'</p></a>
					</td> 
					<td width="15"></td> 
					<td width="180" valign="top"> 
						<a href="'.$update3link.'" style="color: #FFF; text-decoration: none;"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444;">'.$update3title.'</h5></a>
						<a href="'.$update3link.'" style="color: #FFF; text-decoration: none;"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$update3caption.'</p></a>
					</td> 
				</tr> 
			</table><!-- content-4 --> 
		</td> 
	</tr><!-- content-4 -->  
	</tr><!-- content-5 --> 
	<td>
	<tr bgcolor="#FFFFFF" align="center"> 
		<a href="'.$articlelink.'" style="color: #FFF; text-decoration: none;"><td height="30"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444 !important; text-align:left;">'.$maincontenttitle.'</h5></a></td> 
	</tr> 
	<tr> 
		<td> 
			<table id="content-6" cellpadding="0" cellspacing="0" align="center" bgcolor="#FFFFFF"> 
				<p align="left" style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$article.'</p> 
				<p align="center" style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;"><a href="http://www.worldwidelighthouses.com" style="text-decoration: none; color: #4A72AF;">Visit the website now!</a></p> 
			</table> 
		</td> 
	</tr> 

</table><!-- main --> 
<table id="bottom-message" cellpadding="20" cellspacing="0" width="600" align="center"> 
	<tr> 
		<td align="center"> 
			<p style="font-size: 12px; line-height: 1.5; font-family: Arial, Helvetica, sans-serif; color: #444444; margin: 0; padding: 0;">You are receiving this email because you signed up for updates</p> 
			<p style="font-size: 12px; line-height: 1.5; font-family: Arial, Helvetica, sans-serif; color: #444444; margin: 0; padding: 0;"><a href="mailto:dantonybrown@hotmail.co.uk?subject=Unsubscribe%20Me&body=Please%20unsubscribe%20me%20from%20your%20mailing%20list" style="text-decoration: none; color: #4A72AF;">Unsubscribe instantly</a>
		</td> 
	</tr> 
</table><!-- top message --> 
</td></tr></table><!-- wrapper --> 

</body> 
</html>
';

echo '<div class="Textbox"><h2>Email Preview:</h2>';
echo '<p>If you are happy with the below preview (note: Make sure you check all links work and spelling is correct before sending) then click te button below</p>';
?>
<form action="Send-Email.php" method="post">
<input type="hidden" value="<?php $emailcontent?>" name="emailcontent">
<input type="submit" value="Send Email to Entire Contact List">
</form>

 

Link to comment
Share on other sites

Oh, the part that was giving you a problem wasn't very clear. I just tried this, and I believe it's what you're looking for. This will get it through to the $_POST array in the second script.

 

<input type="hidden" value="<?php echo htmlentities($emailcontent); ?>" name="emailcontent">

Link to comment
Share on other sites

Its so different, its not a rendering bug. It also renders the same way when sent to the Email Clients.

 

Heres the latest code for both pages:

 

Upload-Images-and-Preview-Email.php

<?php
session_start();
if ($_SESSION['adminlogin'] == 1){
	//Run
}
else {
header('Location: Log-In.php');
exit;
}
?>
<!DOCTYPE HTML>
<html lang="en-GB">
<head>
            <meta charset="utf-8">
            <!--Search Engine Meta Tags--> 
            <meta name="author" content="Worldwide Lighthouses">
            <meta name="keywords" content="Lighthouses,Lightships,Trinity House,Fog Signals,Fog Horns,Fresnel">
            <meta name="description" content="Worldwide Lighthouses is the number 1 source of information, pictures and videos on the Subject of Lighthouses and Lightships">
            <!--Stylesheets/Javascript-->
            <link rel="stylesheet" href="../../Page-Layout.css" media="screen and (min-width: 481px)">
            <link rel="stylesheet" href="../../Mobile-Page-Layout.css" media="only screen and (max-width:480px)">
            <!--Mobile Browser Support-->
            <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
            <!--IE Support-->
            <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link rel="stylesheet" href="../Page-Layout.css"><![endif]-->
<meta name="application-name" content="Worldwide Lighthouses"> 
	<meta name="msapplication-starturl" content="http://worldwidelighthouses.com/"> 
        	<meta name="msapplication-tooltip" content="Worldwide Lighthouses: Your number one source of Lighthouse Information, Videos and Pictures"> 
        	<meta name="msapplication-task" content="name=Lighthouses;action-uri=http://worldwidelighthouses.com/Lighthouses.php;icon-uri=http://worldwidelighthouses.com/IE9/Lighthouses.ico"> 
        	<meta name="msapplication-task" content="name=Lightships;action-uri=http://worldwidelighthouses.com/Lightships.php;icon-uri=http://worldwidelighthouses.com/IE9/Lightships.ico"> 
	<meta name="msapplication-task" content="name=Fog Signals;action-uri=http://worldwidelighthouses.com/Fog-Signals.php;icon-uri=http://worldwidelighthouses.com/IE9/Fog-Signals.ico"> 
       		<meta name="msapplication-task" content="name=Glossary;action-uri=http://worldwidelighthouses.com/Glossary.php;icon-uri=http://worldwidelighthouses.com/IE9/Glossary.ico">
            	<title>Mailing List Administration | Worldwide Lighthouses</title> 
            </head>
<body>
  <header>
	<h1 id="WWLH">Worldwide Lighthouses</h1>
	<form method="get" action="http://www.worldwidelighthouses.com/Search/search.php" id="Search-Box">
		<input type="search" placeholder="Search Worldwide Lighthouses" name="query" id="query" size="30" value="" autocomplete="off">	
		<input type="submit" value="Search">
           		<input type="hidden" name="search" value="1"> 
  		</form>
</header> 	<nav>
  		<ul id="Nav">
		<li class="MenuButton" id="Index"><a href="http://www.worldwidelighthouses.com/Index.php"><p class="Nav">Home</p></a></li>
       		<li class="MenuButton" id="Lighthouses"><a href="http://www.worldwidelighthouses.com/Lighthouses.php"><p class="Nav">Lighthouses</p></a></li>
       		<li class="MenuButton" id="Lightships"><a href="http://www.worldwidelighthouses.com/Lightships.php"><p class="Nav">Lightships</p></a></li>
       		<li class="MenuButton" id="FogSignals"><a href="http://www.worldwidelighthouses.com/Fog-Signals.php"><p class="Nav">Fog Signals</p></a></li>
            <li class="MenuButton" id="Daymarks"><a href="http://www.worldwidelighthouses.com/Daymarks.php"><p class="Nav">Daymarks</p></a></li>
            <li class="MenuButton" id="Buoys"><a href="http://www.worldwidelighthouses.com/Buoys.php"><p class="Nav">Buoys</p></a></li>
       		<li id="MenuButtonLast"><a href="http://www.worldwidelighthouses.com/Glossary.php"><p class="Nav">Glossary</p></a></li>
	</ul>
</nav>
        <?php
	if ($_SESSION['adminlogin']==1) {
		echo '<div id="logout">
			  <div style="float:left; width:30%; text-align:left;!important">
			  <a href="Log-In-Accept-Deny.php">Back to Admin Home</a>
			  </div>
			  <div style="float:right; width:70%;">
			  <a href="Logout.php">Log Out of Admin</a>
			  <p style="font-size:10px;">Always Sign Out when Finished!</p>
			  </div></div>';}
?> 
    <article>
<?php
$title = $_POST['title'];

$introparagraph = $_POST['introparagraph'];

$update1title = $_POST['update1title'];
$update2title = $_POST['update2title'];
$update3title = $_POST['update3title'];

$update1caption = $_POST['update1caption'];
$update2caption = $_POST['update2caption'];
$update3caption = $_POST['update3caption'];

$update1link = $_POST['update1link'];
$update2link = $_POST['update2link'];
$update3link = $_POST['update3link'];

$maincontenttitle = $_POST['maincontenttitle'];
$article = $_POST['article'];
$articlelink = $_POST['articlelink'];

#################################################################
#####################IMAGE UPLOAD SCRIPT#########################
#################################################################


// Where the mainimage file is going to be placed
$target_path_mainimage = "Newsletter-Images/Main-Images/";
// Wheere the update images will be places
$target_path_updateimage1 = "Newsletter-Images/Update-Images/1/";
$target_path_updateimage2 = "Newsletter-Images/Update-Images/2/";
$target_path_updateimage3 = "Newsletter-Images/Update-Images/3/";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
//Main
$target_path_mainimage = $target_path_mainimage . basename( $_FILES['mainimage']['name']); 
//Update Images
$target_path_updateimage1 = $target_path_updateimage1 . basename( $_FILES['update1']['name']); 
$target_path_updateimage2 = $target_path_updateimage2 . basename( $_FILES['update2']['name']); 
$target_path_updateimage3 = $target_path_updateimage3 . basename( $_FILES['update3']['name']); 

//Move the main image file to its location
if(move_uploaded_file($_FILES['mainimage']['tmp_name'], $target_path_mainimage)) {
} else{
    echo "There was an error uploading the main image file, please try again!";
}
//Move the update images to their location
if(move_uploaded_file($_FILES['update1']['tmp_name'], $target_path_updateimage1)) {
} else{
    echo "There was an error uploading the 1st update image file, please try again!";
}

if(move_uploaded_file($_FILES['update2']['tmp_name'], $target_path_updateimage2)) {
} else{
    echo "There was an error uploading the 2nd update image file, please try again!";
}

if(move_uploaded_file($_FILES['update3']['tmp_name'], $target_path_updateimage3)) {
} else{
    echo "There was an error uploading the 3rd update image file, please try again!";
}
##############################################################################
######################### END IMAGE UPLOAD SCRIPT ############################
##############################################################################
$mainimageurl = "http://www.worldwidelighthouses.com/Newsletter/Admin/Newsletter-Images/Main-Images/".basename( $_FILES['mainimage']['name']);
$update1imageurl = "http://www.worldwidelighthouses.com/Newsletter/Admin/Newsletter-Images/Update-Images/1/".basename( $_FILES['update1']['name']);
$update2imageurl = "http://www.worldwidelighthouses.com/Newsletter/Admin/Newsletter-Images/Update-Images/2/".basename( $_FILES['update2']['name']);
$update3imageurl = "http://www.worldwidelighthouses.com/Newsletter/Admin/Newsletter-Images/Update-Images/3/".basename( $_FILES['update3']['name']);

$emailcontent = '
<html> 
<head> 
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
   <title>'.$title.'</title> 
</head> 
<body style="margin: 0; padding: 0;"> 

<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#333333"><tr><td> 
<table cellspacing="15" id="main" align="center" width="600" cellpadding="0" bgcolor="ffffff" style="margin-top: 10px; border: 1px solid #cfcece;"> 
	<tr> 
		<td> 
			<table id="header" cellpadding="10" cellspacing="0" align="center" bgcolor="#000000"> 
				<tr> 
					<td width="570" bgcolor="#356A5C"><a href="http://www.worldwidelighthouses.com" style="color: #FFF; text-decoration: none;"><h1 style="font-size: 24px; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; margin: 0; color: #ffffff; padding: 0;">Worldwide Lighthouses</h1></a><h2 style="font-size: 24px; font-family: Arial, Helvetica, sans-serif; margin: 0; color: #ffffff !important; padding: 0;">'.$title.'</h2></td> 
				</tr> 
				<tr> 
					<td width="570" align="right" bgcolor="#154A3C"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #ffffff; margin: 0; padding: 0;">'.date("F Y").'</p></td> 
				</tr> 
			</table><!-- header --> 
		</td> 
	</tr><!-- header --> 

	<tr> 
		<td></td> 
	</tr> 
	<tr> 
		<td> 
			<table id="content-1" cellpadding="0" cellspacing="0" align="center"> 
                
			</table>
			<img src="'.$mainimageurl.'" height="190" alt="'.$title.'" width="570" style="display: block;" /><!-- content 1 --> 
		</td> 
	</tr><!-- content 1 --> 
	<tr> 
		<td> 
			<table id="content-2" cellpadding="0" cellspacing="0" align="center"> 
				<tr> 
					<td width="570"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode',".' sans-serif; color: #444444; margin: 0; padding: 0;">'.$introparagraph.'</p></td> 
				</tr> 
			</table><!-- content-2 --> 
		</td> 
	</tr><!-- content-2 --> 
	<tr> 
		<td> 
			<table id="content-3" cellpadding="0" cellspacing="0" align="center"> 
				<tr> 
					<td valign="top" width="170" bgcolor="d0d0d0" style="padding: 5px;"> 
						<a href="'.$update1link.'" style="color: #FFF; text-decoration: none;"><img src="'.$update1imageurl.'" alt="'.$update1title.'" style="display: block;" /></a>
					</td> 
					<td width="15"></td> 
					<td valign="top" width="170" bgcolor="d0d0d0" style="padding: 5px;"> 
						<a href="'.$update2link.'" style="color: #FFF; text-decoration: none;"><img src="'.$update2imageurl.'" alt="'.$update2title.'" style="display: block;" /></a>
					</td> 
					<td width="15"></td> 
					<td valign="top" width="170" bgcolor="d0d0d0" style="padding: 5px;"> 
						<a href="'.$update3link.'" style="color: #FFF; text-decoration: none;"><img src="'.$update3imageurl.'" alt="'.$update3title.'" style="display: block;" /></a> 
					</td> 
				</tr> 
			</table><!-- content-3 --> 
		</td> 
	</tr><!-- content-3 --> 
	<tr> 
		<td> 
			<table id="content-4" cellpadding="0" cellspacing="0" align="center"> 
				<tr> 
					<td width="180" valign="top"> 
						<a href="'.$update1link.'" style="color: #FFF; text-decoration: none;"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444;">'.$update1title.'</h5></a> 
						<a href="'.$update1link.'" style="color: #FFF; text-decoration: none;"><p style="font-size: 12px; line-height: 1.5; font-family:'." 'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$update1caption.'</p></a>
					</td> 
					<td width="15"></td> 
					<td width="180" valign="top"> 
						<a href="'.$update2link.'" style="color: #FFF; text-decoration: none;"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444;">'.$update2title.'</h5></a>
						<a href="'.$update2link.'" style="color: #FFF; text-decoration: none;"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$update2caption.'</p></a>
					</td> 
					<td width="15"></td> 
					<td width="180" valign="top"> 
						<a href="'.$update3link.'" style="color: #FFF; text-decoration: none;"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444;">'.$update3title.'</h5></a>
						<a href="'.$update3link.'" style="color: #FFF; text-decoration: none;"><p style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$update3caption.'</p></a>
					</td> 
				</tr> 
			</table><!-- content-4 --> 
		</td> 
	</tr><!-- content-4 -->  
	</tr><!-- content-5 --> 
	<td>
	<tr bgcolor="#FFFFFF" align="center"> 
		<a href="'.$articlelink.'" style="color: #FFF; text-decoration: none;"><td height="30"><h5 style="font-size: 18px; margin: 0 0 0.8em; font-family: Arial, Helvetica, sans-serif; color: #444444 !important; text-align:left;">'.$maincontenttitle.'</h5></a></td> 
	</tr> 
	<tr> 
		<td> 
			<table id="content-6" cellpadding="0" cellspacing="0" align="center" bgcolor="#FFFFFF"> 
				<p align="left" style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;">'.$article.'</p> 
				<p align="center" style="font-size: 12px; line-height: 1.5; font-family:'."'Lucida Grande', 'Lucida Sans', 'Lucida Sans Unicode'".', sans-serif; color: #444444; margin: 0; padding: 0;"><a href="http://www.worldwidelighthouses.com" style="text-decoration: none; color: #4A72AF;">Visit the website now!</a></p> 
			</table> 
		</td> 
	</tr> 

</table><!-- main --> 
<table id="bottom-message" cellpadding="20" cellspacing="0" width="600" align="center"> 
	<tr> 
		<td align="center"> 
			<p style="font-size: 12px; line-height: 1.5; font-family: Arial, Helvetica, sans-serif; color: #444444; margin: 0; padding: 0;">You are receiving this email because you signed up for updates</p> 
			<p style="font-size: 12px; line-height: 1.5; font-family: Arial, Helvetica, sans-serif; color: #444444; margin: 0; padding: 0;"><a href="mailto:dantonybrown@hotmail.co.uk?subject=Unsubscribe%20Me&body=Please%20unsubscribe%20me%20from%20your%20mailing%20list" style="text-decoration: none; color: #4A72AF;">Unsubscribe instantly</a>
		</td> 
	</tr> 
</table><!-- top message --> 
</td></tr></table><!-- wrapper --> 

</body> 
</html>
';

echo '<div class="Textbox"><h2>Email Preview:</h2>';
echo '<p>If you are happy with the below preview (note: Make sure you check all links work and spelling is correct before sending) then click te button below</p>';
?>
<form action="Send-Email.php" method="post">
<input type="hidden" value="<?php echo htmlentities($emailcontent); ?>" name="emailcontent">
<input type="submit" value="Send Email to Entire Contact List">
</form>
</div>
<?php echo $emailcontent;?>
</article>
<footer>
    <ul>
	<li><a href="http://www.worldwidelighthouses.com/About.php">About</a></li>
        <li><a href="http://www.worldwidelighthouses.com/Contact-us.php">Contact</a></li>
        <li><a href="http://www.worldwidelighthouses.com/Use-Our-Media.php">Use our media</a></li>
        <li><a href="http://www.worldwidelighthouses.com/Search/search.php">Search</a></li>
        <li><a href="http://www.worldwidelighthouses.com/Social-Networking.php">Social</a></li>
        <li><a href="#Top">Back to top</a></li>
    </ul>
    <br>
    <br>
    	&#169; Worldwide Lighthouses <?php echo date("Y"); ?>
</footer>
</body>

 

Send-Email.php

<?php
session_start();
if ($_SESSION['adminlogin'] == 1){
	//Run
}
else {
header('Location: Log-In.php');
exit;
}
?>
<!DOCTYPE HTML>
<html lang="en-GB">
<head>
            <meta charset="utf-8">
            <!--Search Engine Meta Tags--> 
            <meta name="author" content="Worldwide Lighthouses">
            <meta name="keywords" content="Lighthouses,Lightships,Trinity House,Fog Signals,Fog Horns,Fresnel">
            <meta name="description" content="Worldwide Lighthouses is the number 1 source of information, pictures and videos on the Subject of Lighthouses and Lightships">
            <!--Stylesheets/Javascript-->
            <link rel="stylesheet" href="../../Page-Layout.css" media="screen and (min-width: 481px)">
            <link rel="stylesheet" href="../../Mobile-Page-Layout.css" media="only screen and (max-width:480px)">
            <!--Mobile Browser Support-->
            <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
            <!--IE Support-->
            <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link rel="stylesheet" href="../Page-Layout.css"><![endif]-->
<meta name="application-name" content="Worldwide Lighthouses"> 
	<meta name="msapplication-starturl" content="http://worldwidelighthouses.com/"> 
        	<meta name="msapplication-tooltip" content="Worldwide Lighthouses: Your number one source of Lighthouse Information, Videos and Pictures"> 
        	<meta name="msapplication-task" content="name=Lighthouses;action-uri=http://worldwidelighthouses.com/Lighthouses.php;icon-uri=http://worldwidelighthouses.com/IE9/Lighthouses.ico"> 
        	<meta name="msapplication-task" content="name=Lightships;action-uri=http://worldwidelighthouses.com/Lightships.php;icon-uri=http://worldwidelighthouses.com/IE9/Lightships.ico"> 
	<meta name="msapplication-task" content="name=Fog Signals;action-uri=http://worldwidelighthouses.com/Fog-Signals.php;icon-uri=http://worldwidelighthouses.com/IE9/Fog-Signals.ico"> 
       		<meta name="msapplication-task" content="name=Glossary;action-uri=http://worldwidelighthouses.com/Glossary.php;icon-uri=http://worldwidelighthouses.com/IE9/Glossary.ico">
            	<title>Edit Contact | Worldwide Lighthouses</title> 
            </head>
<body>
  <header>
	<h1 id="WWLH">Worldwide Lighthouses</h1>
	<form method="get" action="http://www.worldwidelighthouses.com/Search/search.php" id="Search-Box">
		<input type="search" placeholder="Search Worldwide Lighthouses" name="query" id="query" size="30" value="" autocomplete="off">	
		<input type="submit" value="Search">
           		<input type="hidden" name="search" value="1"> 
  		</form>
</header> 	<nav>
  		<ul id="Nav">
		<li class="MenuButton" id="Index"><a href="http://www.worldwidelighthouses.com/Index.php"><p class="Nav">Home</p></a></li>
       		<li class="MenuButton" id="Lighthouses"><a href="http://www.worldwidelighthouses.com/Lighthouses.php"><p class="Nav">Lighthouses</p></a></li>
       		<li class="MenuButton" id="Lightships"><a href="http://www.worldwidelighthouses.com/Lightships.php"><p class="Nav">Lightships</p></a></li>
       		<li class="MenuButton" id="FogSignals"><a href="http://www.worldwidelighthouses.com/Fog-Signals.php"><p class="Nav">Fog Signals</p></a></li>
            <li class="MenuButton" id="Daymarks"><a href="http://www.worldwidelighthouses.com/Daymarks.php"><p class="Nav">Daymarks</p></a></li>
            <li class="MenuButton" id="Buoys"><a href="http://www.worldwidelighthouses.com/Buoys.php"><p class="Nav">Buoys</p></a></li>
       		<li id="MenuButtonLast"><a href="http://www.worldwidelighthouses.com/Glossary.php"><p class="Nav">Glossary</p></a></li>
	</ul>
</nav>
        <?php
	if ($_SESSION['adminlogin']==1) {
		echo '<div id="logout">
			  <div style="float:left; width:30%; text-align:left;!important">
			  <a href="Log-In-Accept-Deny.php">Back to Admin Home</a>
			  </div>
			  <div style="float:right; width:70%;">
			  <a href="Logout.php">Log Out of Admin</a>
			  <p style="font-size:10px;">Always Sign Out when Finished!</p>
			  </div></div>';}
?> 
<article>
    <h1 class="Title">Update Contact Record</h1>
  <div class="Textbox"> 
	<?php
	$emailcontent = $_POST['emailcontent'];
	#################################################
	############ EMAIL HEADERS & SEND ###############
	#################################################	
	$to = "DanTonyBrown@Gmail.com,DanTonyBrown@hotmail.co.uk";
	$subject = "$title";
	$message = "$emailcontent";
	$from = "newsletter@worldwidelighthouses.com";
	$headers = "From: Worldwide-Lighthouses-Newsletter@worldwidelighthouses.com\r\n";
	$headers .= "Reply-To: dantonybrown@hotmail.co.uk\r\n";
	$headers .= "Return-Path: dantonybrown@hotmail.co.uk\r\n";
	$headers .= 'MIME-Version: 1.0' . "\r\n";
	$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
	mail($to,$subject,$message,$headers);
	echo 'Email sent.<br>';
	echo '<a href="Admin.php">Go Back to Contact Admin Centre</a><br><br>';

	echo $emailcontent;
	?>
    </div>
</article>
    <footer>
    <ul>
	<li><a href="http://www.worldwidelighthouses.com/About.php">About</a></li>
        <li><a href="http://www.worldwidelighthouses.com/Contact-us.php">Contact</a></li>
        <li><a href="http://www.worldwidelighthouses.com/Use-Our-Media.php">Use our media</a></li>
        <li><a href="http://www.worldwidelighthouses.com/Search/search.php">Search</a></li>
        <li><a href="http://www.worldwidelighthouses.com/Social-Networking.php">Social</a></li>
        <li><a href="#Top">Back to top</a></li>
    </ul>
    <br>
    <br>
    	&#169; Worldwide Lighthouses <?php echo date("Y"); ?>
</footer>
</body>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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