Jump to content


Photo

Form help


  • Please log in to reply
29 replies to this topic

#21 phpPrincess

phpPrincess
  • Members
  • PipPip
  • Member
  • 29 posts

Posted 30 May 2006 - 06:13 PM

i thought thats what im doing because the Message: box is showing in the email

#22 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 30 May 2006 - 06:22 PM

As everything is a bit messed, I took the liberty to rewrite your sendeail.php script:

I left some comments between the lines, please read them.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>..::..RateMyBoyfriend..::..</title>
<style type="text/css">
<!--
body {
background-color: #424242;
background-image: url();
}
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
-->
</style></head>

<body>
<table width="200" border="0" align="center">
<tr>
<td width="490" colspan="4"><p>&nbsp;</p>
<p>&nbsp;</p>
<table width="433" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="433">

<?php

// These are the real variables for the visitor's info
// Although you don't seem to be using them anywhere
$ip = $_SERVER['REMOTE_ADDR'];
$httpref = $_SERVER['HTTP_REFERER'];
$httpagent = $_SERVER['HTTP_USER_AGENT'];

$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];

// I wonder what you are going to do with this.
// The other page doesn't have a field named "attn"
$attn = $_POST['attn'];

$myemail = "erinkuzma@yahoo.com";

// This is a true regex check for a valid email
if (!preg_match("/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/", $_POST['visitormail'])) {
   echo "<h2>Use Back - Enter valid e-mail</h2>\n";
   $dontsend = true;
}

if (empty($visitormail) || empty($_POST['notes'])) {
   echo "<h2>Use Back - fill in all fields</h2>\n";
   $dontsend = true;
}

// Only output $badinput if it's set.
if ($dontsend) {
   echo "<h2>Feedback was NOT submitted</h2>\n";
   die();
} 

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

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

// This means, strip slashes only if magic quotes are on
$notes = (get_magic_quotes_gpc()) ? stripslashes($_POST['notes']) : $_POST['notes'];

$message = " $todayis [EST] \r\n
Attention: $attn \r\n
Message: $notes \r\n
From: $visitor ($visitormail) \r\n";

// This is a rewritten part of Q/A
$question = "How often do you visit MOSI? $_POST[Q1] \r\n";
$question .= "How often do you visit museums in general? $_POST[Q2] \r\n";
$question .= "What is your gender? $_POST[Q3] \r\n";
$question .= "What is your age group? $_POST[Q4] \r\n";
$question .= "Do you currently live in Tampa? $_POST[Q5] \r\n";
$question .= "Including yourself, how many persons are there in your group or family visiting the museum with you today? $POST[Q6] \r\n";
$question .= "How many of those are aged 12 or over, again, including yourself? $_POST[Q7] \r\n";

$headers = "From: $visitor <$visitormail> \r\n";

if (!empty($myemail)) {
   if (mail($myemail, $subject, $message . $question, $headers)) {
      echo 'Email sent';
   } else {
      echo 'Error sending email';
   }
}

?>

<p align="left" class="style1">
<strong>Date:</strong> <?php echo $todayis ?>
<br />
<strong>Thank You :</strong> ( <?php echo $visitormail; ?> )
<br />

<br />
<strong>Message:</strong><br />
<?php echo nl2br($notesout); ?>
<br />
<?php echo $question . '<br /><br />' . $ip; ?>

<br /><br />
<a href="WhatDoYouThink.php"> Send another message.. </a></p> </td>
</tr>
</table>
<p>&nbsp;</p></td>
</tr>
</table>

~ D Kuang

#23 phpPrincess

phpPrincess
  • Members
  • PipPip
  • Member
  • 29 posts

Posted 30 May 2006 - 06:40 PM

ok so i have a bunch of useless code in there? figures. did u get the message when it redirected that the fields werent all filled in? and its either taking forever to get the email or it didnt work....hummmm

[!--quoteo(post=378466:date=May 30 2006, 02:37 PM:name=phpPrincess)--][div class=\'quotetop\']QUOTE(phpPrincess @ May 30 2006, 02:37 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
ok so i have a bunch of useless code in there? figures. did u get the message when it redirected that the fields werent all filled in? and its either taking forever to get the email or it didnt work....hummmm
[/quote]


i didnt get it

#24 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 30 May 2006 - 06:58 PM

Change
if (!empty($myemail)) {
   mail($myemail, $subject, $message . $question, $headers);
}
To
if (!empty($myemail)) {
   if (mail($myemail, $subject, $message . $question, $headers)) {
      echo 'Email sent';
   } else {
      echo 'Error sending email';
   }
}
This will throw an error message if the email fails.
~ D Kuang

#25 phpPrincess

phpPrincess
  • Members
  • PipPip
  • Member
  • 29 posts

Posted 30 May 2006 - 07:08 PM



Use Back - fill in all fields
Feedback was NOT submitted

-message after i fixed it

#26 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 30 May 2006 - 07:10 PM

Damn, forgot. Change:

if (empty($visitormail) || empty($notes)) {
   echo "<h2>Use Back - fill in all fields</h2>\n";
   $dontsend = true;
}

To:

if (empty($visitormail) || empty($_POST['notes'])) {
   echo "<h2>Use Back - fill in all fields</h2>\n";
   $dontsend = true;
}

I also updated the entire script (other post) if you want to copy everything at once.
~ D Kuang

#27 phpPrincess

phpPrincess
  • Members
  • PipPip
  • Member
  • 29 posts

Posted 30 May 2006 - 07:26 PM

ok im 99% there..

im not getting the email

#28 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 30 May 2006 - 07:33 PM

But did you get the error message (Error sending mail)?
If not, there may be a problem with the server (and in this case you'd have little to do).

Or just wait a bit more, and also check Bulk/Spam folders.
~ D Kuang

#29 phpPrincess

phpPrincess
  • Members
  • PipPip
  • Member
  • 29 posts

Posted 30 May 2006 - 07:45 PM

[!--quoteo(post=378488:date=May 30 2006, 03:33 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 30 2006, 03:33 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
But did you get the error message (Error sending mail)?
If not, there may be a problem with the server (and in this case you'd have little to do).

Or just wait a bit more, and also check Bulk/Spam folders.
[/quote]

i got the error message

ok i wasnt gunna ask you, i was gunna figure it out by myself cause it doesnt sseem that hard but how can i get the questions on separate lines in the email i tryied <br> like crazy but nothing, just tell me where to put them

#30 phpPrincess

phpPrincess
  • Members
  • PipPip
  • Member
  • 29 posts

Posted 30 May 2006 - 08:11 PM

well ihave a meeting to go to. thank you for being patience with me.
so i guess the problems now are

-no email
-and getting spaces in the results

-deep sigh- this stuff sucks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users