I’m stuck again. This lightbox code works great when invoked from one of my other pages. But when accessed from option #4 at the bottom of this page I get problems.
http://www.oil-testimonials.com/essential-oils/142
If you click on the link to email to a friend, a nice lightbox appears. If you fill out the information and click the send button, I get a message that is basically a 404 - file not found. There is NOTHING in my script that should cause a 404 to appear. And why does this page work fine when invoked from here:
Please help, I’ve been working on this new lightbox code all day.
Thanks!
<?php
include 'startSession.php';
include 'db.inc.php';
$action = $_REQUEST['action'];
$kind = $_REQUEST["kind"];
$uID = $_REQUEST["uID"];
$tID = $_REQUEST["tID"];
$colorBackground = $_SESSION['colorBackground'];
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
// Code to populate the form
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
if ($action== "showForm") {
?>
<html>
<head>
<link href="/css/styleSheet.css" rel="stylesheet" type="text/css" />
<link href="/css/lightbox.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="<?php echo $colorBackground; ?>">
<blockquote>
<form id="myform" action="sendEmail.php" method="post">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<br>
<?php
if ($kind =="1") {
$getName = "select firstname from users where uID = '$uID'";
$results = mysql_query($getName) or die("<b>A fatal MySQL error occured</b>.\
<br />Query: " . $sql . "<br />\
Error: (" . mysql_errno() . ") " . mysql_error());
$row = mysql_fetch_assoc($results);
$firstname = $row['firstname'];
print ("<H2>User Contact</H2>");
print ("<tr><td colspan='2' valign='top'>Reach $firstname with a question or comment using this form.<br><br></td></tr>");
} // end if if ($kind =="1")
if ($kind =="2") {
print ("<H2>Testimonial Question</H2>");
print ("<tr><td colspan='2' valign='top'>Use this email form to ask a question about this testimonial.<br><br></td></tr>");
}// end if ($kind =="2")
if ($kind =="3") {
print ("<H2>Email Testimonial</H2>");
print ("<tr><td colspan='2' valign='top'>Use this form to email a copy of this testimonial.<br><br></td></tr>");
print ("<tr><td align='right'>To:</td><td><input name='to' id='to' type='text'></td></tr>");
print ("<tr><td align='right'>Subject:</td><td><input name='subject' id='subject' type='text'></td></tr>");
} // end if ($kind =="3")
?>
<tr>
<td align="right">Message:</td>
<td>
<textarea name="message" cols="30" rows="10"></textarea>
</td>
</tr>
<tr>
<td> </td>
<td colspan="2">
<input name="uID" id="uID" type="hidden" value="<?php echo $uID; ?>">
<input name="kind" id="kind" type="hidden" value="<?php echo $kind; ?>">
<input name="firstname" id="firstname" type="hidden" value="<?php echo $firstname; ?>">
<p>
<a id="myform" class="lbAction" rel="insert" href="sendEmail.php?action=processData"><button>Submit</button></a></td>
</tr>
</table>
</form>
</blockquote>
<?php
} // end ($action== "showForm")
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
// Code to send the actual email
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
if ($action== "processData") {
$uID = $_REQUEST['uID'];
$message = $_REQUEST['message'];
$to = $_REQUEST['to'];
$subject = $_REQUEST['subject'];
$firstname = $_REQUEST['firstname'];
$kind = $_REQUEST['kind'];
$loginID = $_SESSION['loginID'];
$loginFirst = $_SESSION['loginFirst'];
$loginLast = $_SESSION['loginLast'];
$loginEmail = $_SESSION['loginEmail'];
/////////////////////////////////////////////////////////////////////////
//Contacting a site user
/////////////////////////////////////////////////////////////////////////
if ($kind == "1") {
$getEmail = "select email from users where uID = '$uID'";
$results = mysql_query($getEmail) or die("<b>A fatal MySQL error occured</b>.\
<br />Query: " . $sql . "<br />\
Error: (" . mysql_errno() . ") " . mysql_error());
$row = mysql_fetch_assoc($results);
$email = $row['email'];
$text="$firstname,
We have a visitor who is trying to make contact with you. $loginFirst, like all of our visitors, is never shown your direct email address. This message is sent by an automated form. However, if you choose to reply to this message, your address will no longer be secret. $loginFirst may be new to essential oils, so consider this a wonderful sharing opportunity.
------------------------------------------------------------------
$message
------------------------------------------------------------------
Source: sendEmail lightbox";
$confirmationMessage = "Your email is now scheduled to be sent to $firstname. Our email server sends groups of messages every half hour, so please be patient until it is delivered.
<p>
Thank you";
$subject = "Essential oil contact request";
$type = "Contact User";
} // end if ($kind == "1")
/////////////////////////////////////////////////////////////////////////
//Asking a question about a testimonial
/////////////////////////////////////////////////////////////////////////
if ($kind == "2") {
$getEmail = "select email from users where uID = '$uID'";
$results = mysql_query($getEmail) or die("<b>A fatal MySQL error occured</b>.\
<br />Query: " . $sql . "<br />\
Error: (" . mysql_errno() . ") " . mysql_error());
$row = mysql_fetch_assoc($results);
$email = $row['email'];
$confirmationMessage = "Your email is now scheduled to be sent to:
$email
Our email server sends groups of messages every half hour, so please be patient until it is delivered.";
$type = "Forward Testimonial";
$subject = "Question about your testimonial";
} // end if if ($kind == "2")
/////////////////////////////////////////////////////////////////////////
//Forwarding a testimonial
/////////////////////////////////////////////////////////////////////////
if ($kind == "3") {
$confirmationMessage = "Your question has been sent.";
$type = "Forward Testimonial";
} // end if if ($kind == "3")
?>
<html>
<head>
<link href="/css/styleSheet.css" rel="stylesheet" type="text/css" />
<link href="/css/lightbox.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="<?php echo $colorBackground; ?>">
<blockquote>
<br>
<H2>Success</H2>
<?php echo $confirmationMessage; ?>
<p>
<a href="#" class="lbAction" rel="deactivate"><br><button>Close</button></a>
</blockquote>
<?php
$text = addslashes($text);
$today = date("Y-m-d h:i:s");
$addNotification = "INSERT INTO notifications (date, priority, type, sender, recipient, subject, message) VALUES (
'$today',
'1',
'$type',
'$loginEmail',
'$to',
'$finalSubject',
'$text')";
mysql_query($addNotification) OR die("<b>A fatal MySQL error occured</b>.\
<br />Query: " . $addNotification . "<br />\
Error: (" . mysql_errno() . ") " . mysql_error());
} // end if ($action== "processData")
?>
</body>
</html>