tiptop Posted July 6, 2009 Share Posted July 6, 2009 <?php /* subject and email variables */ $emailSubject = 'Client Query!'; $webMaster = 'myemail'; /* Gathering data variables */ $emailField = $_POST['email']; $nameField = $_POST['name']; $p_numberField = $_POST['p_number']; $commentsField = $_POST['comments']; $body = <<<EOD <br><hr><br> Email: $emailField <br> Name: $nameField <br> Phone Number: $p_numberField <br> Comments: $commentsField <br> EOD; $headers = "From: $emailField \r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>untitled</title> <style type="text/css"> <!-- body { background-image: url(background%20links.jpg); } .style1 { font-family: "copperplate Gothic Bold"; color: #51473E; font-size: 36px; } --> </style></head> <body> <p class="style1"> </p> <p class="style1"> </p> <p align="center" class="style1">Thank you for contacting us!</p> <p align="center" class="style1"> your email will be answered within 24 hours</p> </body> </html> EOD; echo "$theResults"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/164909-please-help-mewhat-is-wrong-with-my-script/ Share on other sites More sharing options...
AwptiK Posted July 6, 2009 Share Posted July 6, 2009 Do you get an error? If so, what does it say? Quote Link to comment https://forums.phpfreaks.com/topic/164909-please-help-mewhat-is-wrong-with-my-script/#findComment-869621 Share on other sites More sharing options...
Garethp Posted July 6, 2009 Share Posted July 6, 2009 $theResults = <<<EOD <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>untitled</title> <style type="text/css"> <!-- body { background-image: url(background%20links.jpg); } .style1 { font-family: "copperplate Gothic Bold"; color: #51473E; font-size: 36px; } --> </style></head> <body> <p class="style1"> </p> <p class="style1"> </p> <p align="center" class="style1">Thank you for contacting us!</p> <p align="center" class="style1"> your email will be answered within 24 hours</p> </body> </html> Where's your "s? Quote Link to comment https://forums.phpfreaks.com/topic/164909-please-help-mewhat-is-wrong-with-my-script/#findComment-869622 Share on other sites More sharing options...
AwptiK Posted July 6, 2009 Share Posted July 6, 2009 $theResults = <<<EOD <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>untitled</title> <style type="text/css"> <!-- body { background-image: url(background%20links.jpg); } .style1 { font-family: "copperplate Gothic Bold"; color: #51473E; font-size: 36px; } --> </style></head> <body> <p class="style1"> </p> <p class="style1"> </p> <p align="center" class="style1">Thank you for contacting us!</p> <p align="center" class="style1"> your email will be answered within 24 hours</p> </body> </html> Where's your "s? Good call. Maybe I shouldn't assume the original poster wouldn't be able to catch something like that next time. Quote Link to comment https://forums.phpfreaks.com/topic/164909-please-help-mewhat-is-wrong-with-my-script/#findComment-869626 Share on other sites More sharing options...
tiptop Posted July 6, 2009 Author Share Posted July 6, 2009 im not really that good in php, i got this script from a tutorial, it gets my submit button to send me an email. I have no idea what you guys mean with my "s could you please help me? maybe fix this script? i would be so grateful Quote Link to comment https://forums.phpfreaks.com/topic/164909-please-help-mewhat-is-wrong-with-my-script/#findComment-869765 Share on other sites More sharing options...
AwptiK Posted July 7, 2009 Share Posted July 7, 2009 <?php /* subject and email variables */ $emailSubject = 'Client Query!'; $webMaster = 'myemail'; /* Gathering data variables */ $emailField = $_POST['email']; $nameField = $_POST['name']; $p_numberField = $_POST['p_number']; $commentsField = $_POST['comments']; $body = <<<EOD <br><hr><br> Email: $emailField <br> Name: $nameField <br> Phone Number: $p_numberField <br> Comments: $commentsField <br> EOD; $headers = "From: $emailField \r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>untitled</title> <style type="text/css"> <!-- body { background-image: url(background%20links.jpg); } .style1 { font-family: "copperplate Gothic Bold"; color: #51473E; font-size: 36px; } --> </style></head> <body> <p class="style1"> </p> <p class="style1"> </p> <p align="center" class="style1">Thank you for contacting us!</p> <p align="center" class="style1"> your email will be answered within 24 hours</p> </body> </html> EOD; echo $theResults; ?> What he meant by the "s was that you put " " around $theResults(in the next to last line in the code), which treats it like a string, not the variable that it is. I edited it in the above code. Quote Link to comment https://forums.phpfreaks.com/topic/164909-please-help-mewhat-is-wrong-with-my-script/#findComment-870619 Share on other sites More sharing options...
Philip Posted July 7, 2009 Share Posted July 7, 2009 <?php /* subject and email variables */ $emailSubject = 'Client Query!'; $webMaster = 'myemail'; /* Gathering data variables */ $emailField = $_POST['email']; $nameField = $_POST['name']; $p_numberField = $_POST['p_number']; $commentsField = $_POST['comments']; $body = <<<EOD <br><hr><br> Email: $emailField <br> Name: $nameField <br> Phone Number: $p_numberField <br> Comments: $commentsField <br> EOD; $headers = "From: $emailField \r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>untitled</title> <style type="text/css"> <!-- body { background-image: url(background%20links.jpg); } .style1 { font-family: "copperplate Gothic Bold"; color: #51473E; font-size: 36px; } --> </style></head> <body> <p class="style1"> </p> <p class="style1"> </p> <p align="center" class="style1">Thank you for contacting us!</p> <p align="center" class="style1"> your email will be answered within 24 hours</p> </body> </html> EOD; echo $theResults; ?> What he meant by the "s was that you put " " around $theResults(in the next to last line in the code), which treats it like a string, not the variable that it is. I edited it in the above code. @AwptiK: Actually, echo "$variable" is okay, as double quotes (") will parse variables. Single quotes (') will not and will treat anything in them as a string. @Garethp: which quotes are you referring to? @OP: What is it doing? Does it show the thank you page, but doesn't send the email? Quote Link to comment https://forums.phpfreaks.com/topic/164909-please-help-mewhat-is-wrong-with-my-script/#findComment-870630 Share on other sites More sharing options...
tiptop Posted July 9, 2009 Author Share Posted July 9, 2009 yes it shows the thank you page but i dont get any emails Quote Link to comment https://forums.phpfreaks.com/topic/164909-please-help-mewhat-is-wrong-with-my-script/#findComment-871767 Share on other sites More sharing options...
The Eagle Posted July 10, 2009 Share Posted July 10, 2009 Okay, this is very obvious to me. <?php /* subject and email variables */ $emailSubject = 'Client Query!'; $webMaster = 'myemail'; In this part above, you're supposed to identify your e-mail address and the subject of the email sent to you. Take this example below. <?php /* subject and email variables */ $emailSubject = 'New contact message received!'; $webMaster = 'eagle@vazzer.net; Just replace "eagle@vazzer.net" with your email. 8) Quote Link to comment https://forums.phpfreaks.com/topic/164909-please-help-mewhat-is-wrong-with-my-script/#findComment-872463 Share on other sites More sharing options...
seventheyejosh Posted July 10, 2009 Share Posted July 10, 2009 what quotes indeed? and when i just render the code i get no errors. What are you getting? Quote Link to comment https://forums.phpfreaks.com/topic/164909-please-help-mewhat-is-wrong-with-my-script/#findComment-872470 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.