Member Avatar for Elemen7s

Hi all, I used this method (link below) for my website, which works like a charm.
http://www.daniweb.com/forums/thread277139.html

Now some of my website structure is :
index.php
contact.php
mail-sender.php - ( script to send emails)
template/wide_panel.php - (template where the content is)
content/wide_panel/contact.php -( the content of the contact.php)
content/wide_panel/error_invalid-email.php - ( the content of one of the 2 files)

My problem is, mail-sender.php is going to ask for 2 other .php files ( the error_invalid-email.php and another one) which is then going to use the method above for the template of the 2 pages.

If I use that method, both pages are going to be displayed when only one of them is suppose to be.

What code should I use on the template/wide_panel.php to tell it, if mail-sender.php asks for error_invalid-email.php display error_invalid-email.php if it asks for the other file display the other file.

Any suggestions will be really appreciated
Thanks in advanced

Recommended Answers

All 4 Replies

Member Avatar for rajarajan2017

You can manage that from within mail-sender.php. I dont know whether I given the r8 answer. This is my suggestion.

Member Avatar for Elemen7s

do you know how can I manage that ?

Heres the mail-sender.php

<!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" />
</head>

<body>
<!-- Reminder: Add the link for the 'next page' (at the bottom) -->
<!-- Reminder: Change 'YourEmail' to Your real email -->

<?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];


if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo include ("content/wide_panel/error_invalid-email.php")   ;
die  ;
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn ;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";


mail("email",$subject, $from, $message );

header('location:content/thankyou.php');
?>


</body>
</html>
Member Avatar for rajarajan2017

Is anything written briefly in invalid email.php. you can print the message from here itself r8.

Member Avatar for Elemen7s

but I want to use the same template as the site and I think you should see the method I used cause you didnt check.

Thank you for replying

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.