Jump to content

Form help


phpPrincess

Recommended Posts

im trying to make a survey that emails you the results, i have some of it working. when u fill out the form and hit submit the email gets sent and i only get the email and the message (the botton half ) not the survey questions. any help will be appreciated!


[!--sizeo:4--][span style=\"font-size:14pt;line-height:100%\"][!--/sizeo--]PHP page [!--sizec--][/span][!--/sizec--]


[!--coloro:#330099--][span style=\"color:#330099\"][!--/coloro--]<form method="post" action="sendeail.php">
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
<table width="500">
<tr>
<td width="319"><label><span class="style1">How often do you visit MOSI?</span></label></td>
</tr>
<tr>
<td><span class="style5">
<input type="radio" name="Q1" value="radio">
First visit</span></td>
</tr>
<tr>
<td><span class="style5">
<label>
<input type="radio" name="Q1" value="radio">
Less than once a year</label>
</span></td>
</tr>
<tr>
<td><span class="style5">
<label>
<input type="radio" name="Q1" value="radio">
About once a year</label>
</span></td>
</tr>
<tr>
<td><span class="style5">
<label>
<input type="radio" name="Q1" value="radio">
More than once a year</label>
</span></td>
</tr>
</table>
<br>
<p align="left" class="style1">
<label></label>
</p>
<table width="500">
<tr>
<td><label><span class="style1">How often do you visit museums in general?</span></label></td>
</tr>
<tr>
<td><input type="radio" name="Q2" value="radio">
Less than once a year</td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q2" value="radio">
About once a year</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q2" value="radio">
A few times a year</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q2" value="radio">
Once a month or more</label></td>
</tr>
</table>
<br>
<table width="500">
<tr>
<td><label>What is your gender? </label></td>
</tr>
<tr>
<td><input type="radio" name="Q3" value="radio">
Male</td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q3" value="radio">
Female</label></td>
</tr>
</table>
<br>
<table width="500">
<tr>
<td><label>What is your age group? </label></td>
</tr>
<tr>
<td><input type="radio" name="Q4" value="radio">
15-24</td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q4" value="radio">
25-34</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q4" value="radio">
35-54</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q4" value="radio">
55-64</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q4" value="radio">
65 and over</label></td>
</tr>
</table>
<p align="left" class="style1">&nbsp; </p>
<table width="500">
<tr>
<td><label>Do you currently live in Tampa? </label></td>
</tr>
<tr>
<td><input type="radio" name="Q5" value="radio">
Yes</td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q5" value="radio">
No</label></td>
</tr>
</table>
<p align="left" class="style1">Including yourself, how many persons are there in your group or family visiting the museum with you today?<br>
<label>
<select name="Q6" size="1">
<option selected>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6 or more</option>
</select>
</label>
</p>
<p align="left" class="style1">How many of those are aged 12 or older, again, including yourself?<br>
<label>
<select name="Q7">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6 or more</option>
</select>
</label>
</p>

Your Email:<br />
<input type="text" name="visitormail" size="35" />
<br />
<br />
<br />
Mail Message: <br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send Mail" />
</form>[!--colorc--][/span][!--/colorc--]
[!--sizeo:4--][span style=\"font-size:14pt;line-height:100%\"][!--/sizeo--]
redirected page[!--sizec--][/span][!--/sizec--]


[!--coloro:#CC0000--][span style=\"color:#CC0000\"][!--/coloro--]<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$Q1= $_POST['$Q1'];
$Q2= $_POST['$Q2'];
$Q3= $_POST['$Q3'];
$Q4= $_POST['$Q4'];
$Q5= $_POST['$Q5'];
$Q6= $_POST['$Q6'];
$Q7= $_POST['$Q7'];

$attn = $_POST['attn'];
?>
<!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

$myemail = "erinkuzma@yahoo.com";


if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
}
if(empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
}
echo $badinput;

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

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

$notes = stripcslashes($notes);

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

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

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


if ($myemail != "")
mail($myemail, $attn, $subject, $message, $Q1, $Q2, $Q3, $Q4, $Q5, $Q6, $Q7, $from);

?>
<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 $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
How often do you visit MOSI?<?php echo $Q1 ?> <br>
How often do you visit museums in general? <?php echo $Q2 ?><br>
What is your gender? <?php echo $Q3 ?><br>
What is your age group? <?php echo $Q4 ?><br>
Do you currently live in Tampa? <?php echo $Q5 ?><br>
Including yourself, how many persons are there in your group or family visiting the museum with you today?<?php echo $Q6 ?><br>
How many of those are aged 12 or over, again, including yourself? <?php echo $Q7 ?><br>



<?php echo $ip ?>

<br /><br />
<a href="WhatDoYouThink.php"> Send another message.. </a></p> </td>
</tr>
</table> <p>&nbsp;</p></td>
</tr>
</table>[!--colorc--][/span][!--/colorc--]

Thats what im getting in the email, i need that plus the result of the question



Tuesday, May 30, 2006, 10:11 am [EST]

Attention:

Message: AH!!!!!!!!!!!!!!!!

From: (erinkuzma@yahoo.com)


Browser Info:

Referral :
Link to comment
Share on other sites

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--][code]mail($myemail, $attn, $subject, $message, $Q1, $Q2, $Q3, $Q4, $Q5, $Q6, $Q7, $from);[/code][/quote]
This is incorrect. The mail() function can have at most 5 parameters.

Ken
Link to comment
Share on other sites

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]This is incorrect. The mail() function can have at most 5 parameters.

Ken[/quote]
Yeah, I was just pointing where she should edit it.

Concatenate the variables into $message and send the email.
Try my code.

Whoa sorry, there was a small mistake with it. $attn shouldn't be an argument.
I removed $attn, but I don't know where it should be.

Anyways the mail function is:

bool mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]] )

Which means you mustn't use more than 5 arguments, and at least 3 arguments. And also they must respect that order.
Link to comment
Share on other sites

Try changinf this code:

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

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

to:

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

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

$message .= $Q1
$message .= $Q2
$message .= $Q3
$message .= $Q4
$message .= $Q5
$message .= $Q6
$message .= $Q7

[/code]

and:

[code]mail($myemail, $attn, $subject, $message, $Q1, $Q2, $Q3, $Q4, $Q5, $Q6, $Q7, $from);[/code]

to:
[code]mail($myemail, $attn, $subject, $message, $from);[/code]

or:

[code]mail($myemail, $subject, $message, $from);[/code]
Link to comment
Share on other sites

[!--quoteo(post=378404:date=May 30 2006, 08:31 AM:name=phpPrincess)--][div class=\'quotetop\']QUOTE(phpPrincess @ May 30 2006, 08:31 AM) [snapback]378404[/snapback][/div][div class=\'quotemain\'][!--quotec--]ok now your talking over my head..[/quote]
lol sorry [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /]

Just try to replace your code with what I posted. Check again because I edited my post.

If that doesn't work, try to add :
[b]echo $message;[/b]
right below the mail($myemail, $subject...) line.

It will output the message and you should see what was sent to your email.

LudwigVB,
[code]mail($myemail, $attn, $subject, $message, $from);[/code]
Won't work as expected because the arguments are messed up.
And:
[code]$message .= $Q1
$message .= $Q2
$message .= $Q3
$message .= $Q4
$message .= $Q5
$message .= $Q6
$message .= $Q7[/code]

Can be replaced with:
[code]for ($i=1; $i<8; $i++) {
   $message .= ${'Q' . $i};;
}[/code]
It makes the code shorter [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
Link to comment
Share on other sites

poirot you are right, but this should make more sense to phpPrincess

YOUR code is shorter and that means that is more correct.

[!--quoteo(post=378414:date=May 30 2006, 06:52 PM:name=phpPrincess)--][div class=\'quotetop\']QUOTE(phpPrincess @ May 30 2006, 06:52 PM) [snapback]378414[/snapback][/div][div class=\'quotemain\'][!--quotec--]
am i keeping this
for ($i=1; $i<8; $i++) {
$message .= ${'Q' . $i};;
}
[/quote]


Yes keep this.
It has the same results that my code has and it makes your file smaller!
Link to comment
Share on other sites

still no go.lemme repost my code to make sure im pasting in the right stuff...


[!--coloro:#993399--][span style=\"color:#993399\"][!--/coloro--]<?php

$myemail = "erinkuzma@yahoo.com";


if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
}
if(empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
}
echo $badinput;

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

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

$notes = stripcslashes($notes);

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

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

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


if ($myemail != "")
for ($i=1; $i<8; $i++) {
$message .= ${'Q' . $i};;
}

mail($myemail, $attn, $subject, $message, $from);

?>
<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 $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
How often do you visit MOSI?<?php echo $Q1 ?> <br>
How often do you visit museums in general? <?php echo $Q2 ?><br>
What is your gender? <?php echo $Q3 ?><br>
What is your age group? <?php echo $Q4 ?><br>
Do you currently live in Tampa? <?php echo $Q5 ?><br>
Including yourself, how many persons are there in your group or family visiting the museum with you today?<?php echo $Q6 ?><br>
How many of those are aged 12 or over, again, including yourself? <?php echo $Q7 ?><br>



<?php echo $ip ?> [!--colorc--][/span][!--/colorc--]
Link to comment
Share on other sites

[!--quoteo(post=378421:date=May 30 2006, 07:28 PM:name=phpPrincess)--][div class=\'quotetop\']QUOTE(phpPrincess @ May 30 2006, 07:28 PM) [snapback]378421[/snapback][/div][div class=\'quotemain\'][!--quotec--]
WHAT AM I DOING WRONG!!! ITS NOT WORKING!!!

YOU GUYS WANT THE WHOLE CODE AGAIN
[/quote]

HERE IS THE RIGHT CODE:

FILE:
WhatDoYouThink.php

[code]
<form method="post" action="sendeail.php">
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
<table width="500">
<tr>
<td width="319"><label><span class="style1">How often do you visit MOSI?</span></label></td>
</tr>
<tr>
<td><span class="style5">
<input type="radio" name="Q1" value="First visit">
First visit</span></td>
</tr>
<tr>
<td><span class="style5">
<label>
<input type="radio" name="Q1" value="Less than once a year">
Less than once a year</label>
</span></td>
</tr>
<tr>
<td><span class="style5">
<label>
<input type="radio" name="Q1" value="About once a year">
About once a year</label>
</span></td>
</tr>
<tr>
<td><span class="style5">
<label>
<input type="radio" name="Q1" value="More than once a year">
More than once a year</label>
</span></td>
</tr>
</table>
<br>
<p align="left" class="style1">
<label></label>
</p>
<table width="500">
<tr>
<td><label><span class="style1">How often do you visit museums in general?</span></label></td>
</tr>
<tr>
<td><input type="radio" name="Q2" value="Less than once a year">
Less than once a year</td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q2" value="About once a year">
About once a year</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q2" value="A few times a year">
A few times a year</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q2" value="Once a month or more">
Once a month or more</label></td>
</tr>
</table>
<br>
<table width="500">
<tr>
<td><label>What is your gender? </label></td>
</tr>
<tr>
<td><input type="radio" name="Q3" value="Male">
Male</td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q3" value="Female">
Female</label></td>
</tr>
</table>
<br>
<table width="500">
<tr>
<td><label>What is your age group? </label></td>
</tr>
<tr>
<td><input type="radio" name="Q4" value="15-24">
15-24</td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q4" value="25-34">
25-34</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q4" value="35-54">
35-54</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q4" value="55-64">
55-64</label></td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q4" value="65 and over">
65 and over</label></td>
</tr>
</table>
<p align="left" class="style1">&nbsp; </p>
<table width="500">
<tr>
<td><label>Do you currently live in Tampa? </label></td>
</tr>
<tr>
<td><input type="radio" name="Q5" value="Yes">
Yes</td>
</tr>
<tr>
<td><label>
<input type="radio" name="Q5" value="No">
No</label></td>
</tr>
</table>
<p align="left" class="style1">Including yourself, how many persons are there in your group or family visiting the museum with you today?<br>
<label>
<select name="Q6" size="1">
<option selected>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6 or more</option>
</select>
</label>
</p>
<p align="left" class="style1">How many of those are aged 12 or older, again, including yourself?<br>
<label>
<select name="Q7">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6 or more</option>
</select>
</label>
</p>

Your Email:<br />
<input type="text" name="visitormail" size="35" />
<br />
<br />
<br />
Mail Message: <br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send Mail" />
</form>[/code]

File: sendeail.php

[code]

<!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

$myemail = "erinkuzma@yahoo.com";


if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
}
if(empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
}
echo $badinput;

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

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

$notes = stripcslashes($notes);

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

";
$A1="How often do you visit MOSI?". $Q1 ."\r\n";
$A2="How often do you visit museums in general?". $Q2 ."\r\n";
$A3="What is your gender?". $Q3 ."\r\n";
$A4="What is your age group?". $Q4 ."\r\n";
$A5="Do you currently live in Tampa?". $Q5 ."\r\n";
$A6="Including yourself, how many persons are there in your group or family visiting the museum with you today?". $Q6 ."\r\n";
$A7="How many of those are aged 12 or over, again, including yourself?". $Q7 ."\r\n";

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

if ($myemail != "")
for ($i=1; $i<8; $i++) {
$message .= ${'A' . $i};;
}

if ($myemail != "")
mail($myemail, $subject, $message, $from);

?>
<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 $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $A1 ?> <br>
<?php echo $A2 ?><br>
<?php echo $A3 ?><br>
<?php echo $A4 ?><br>
<?php echo $A5 ?><br>
<?php echo $A7 ?><br><br>
<?php echo $A7 ?><br>



<?php echo $ip ?>

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

At least it's working for me!!!
Link to comment
Share on other sites

[!--quoteo(post=378451:date=May 30 2006, 08:48 PM:name=phpPrincess)--][div class=\'quotetop\']QUOTE(phpPrincess @ May 30 2006, 08:48 PM) [snapback]378451[/snapback][/div][div class=\'quotemain\'][!--quotec--]
ok its working but the results arent displaying next to the question!!1 banging head on desk- im so over this
[/quote]


That's is a matter of HTML.
Try making tables to include text and variables.
Since everything is going to be sent as an e-mail too, don't forget to change the header information of the e-mail to html
Link to comment
Share on other sites

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.
[code]<!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>[/code]
Link to comment
Share on other sites

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) [snapback]378466[/snapback][/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
Link to comment
Share on other sites

Change
[code]if (!empty($myemail)) {
   mail($myemail, $subject, $message . $question, $headers);
}[/code]
To
[code]if (!empty($myemail)) {
   if (mail($myemail, $subject, $message . $question, $headers)) {
      echo 'Email sent';
   } else {
      echo 'Error sending email';
   }
}[/code]
This will throw an error message if the email fails.
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.