PDA

View Full Version : Email Form Using PHP-returned blank email??



Kaotik
March 11th, 2006, 04:33 PM
Okay I don't understand why this is. I have been using this form on my current host and it works perfect. I just switched to another host and I'm using the same script which is set up the same way as before and when I enter at test message into the form, it's sending back a blank email. It'll send the form but the data entered by a user comes back blank. Can anybody help me with this or know why this is? New host supports php based on a linux server.
Example of blank email:
----------------------------------------------
Message from ***
Reply-To:



E-mail sent from ***

From Name:
From E-Mail:
Subject:

Message:

mlk
March 11th, 2006, 06:48 PM
mailto() function is disabled on some hosts due to spam abuse. However you shouldn't be receiving anything at all.

Mind to show some code ?

Kaotik
March 11th, 2006, 08:56 PM
mailto() function is disabled on some hosts due to spam abuse. However you shouldn't be receiving anything at all.

Mind to show some code ?
Sure, however I removed my email for public purposes... It's the same file that comes with the php email form tutorial. Any help is very much appreciated.

<?
/* ************************************************** *****************************************
*** ***
*** SIMPLE EMAILFORM USING PHP - together with Flash 5 ***
*** ***
*** With this script you can make a simple email form, where the script sends ***
*** the submitted message to your email address. ***
*** ***
*** This is a flash form - it also works in HTML. ***
*** ***
*** Files: formular.fla,formular.swf,formular.html and simple_emailform.php ***
*** ***
*** ***
*** The script is placed in a subfolder called "php" ***
*** ***
*** It's very simple, the script doesn't need a database, but the webserver has to ***
*** support PHP. ***
*** Read the comments in the script. ***
*** ***
*** I cannot answer any questions on PHP, but there«s a lot of friendly people on ***
*** the net! ***
*** ***
*** Commented and manipulated for use in Flash by Lars Bregendahl Bro - www.westend.dk ***
*** ***
************************************************** *****************************************
*/
/* ************************************************** **************************
*** $msg relates to the variables that is placed in the body of the mail ***
************************************************** **************************
*/
$msg = "E-mail sent from PC\n\n";
/* ************************************************** ******************************************
*** The string From Name is written in to the body followd by the variable $sender_name ***
************************************************** ******************************************
*/
$msg .= "Your Name: $sender_name\n";
$msg .= "Your E-Mail: $sender_email\n";
$msg .= "Subject: $subject\n\n";
$msg .= "Summary: $message\n\n";
/* ************************************************** ***********
*** \n gives a linebreak - \n\n gives a double linebreak ***
************************************************** ***********
*/
/* ************************************************** **
*** Remember to put in the correct email-adress ***
************************************************** **
*/
$to = "t---@comcast.net";
$subject = "PC Site Submission";
/* ************************************************** ******
*** Writes "Sent from my website" in the from-field ***
************************************************** ******
*/
$mailheaders = "Message from PC \n";
/* ************************************************** ********
*** Writes the senders email in the "Reply-To field" ***
************************************************** ********
*/
$mailheaders .= "Reply-To: $sender_email\n\n";
/* ********************************************
*** Mail Function - executes the script ***
********************************************
*/
mail($to, $subject, $msg, $mailheaders);

?>

mlk
March 12th, 2006, 05:08 AM
That code looks fine, could you show your form code ?

Kaotik
March 12th, 2006, 10:33 AM
Yes, I'll give you the file. Here's the link to the file: Thanks.
- Contact27.fla (http://www.oneduo.net/attch/Contact27.fla)

Kaotik
March 12th, 2006, 11:21 AM
Actually, here's something interesting...this is what I found after doing a bit of research. What they describe in here is exactly what is happening with my php flash submit form.
http://www.uwo.ca/its/email/blockedfiles.html
Is there anyway around this? It's apparent that it's my host because like I mentioned, the other host I was using worked just fine, I uploaded it to my new host via the same folder and get results as state in the first post here. Is there a way I can change something in the coding for it to accept submissions?

Voccart
March 12th, 2006, 12:17 PM
Looking at your php script i think your current host still allows you to use REGISTER_GLOBALS ON. The new host maybe disabled this and set REGISTER_GLOBALS OFF.

http://www.zend.com/zend/art/art-sweat4.php#Heading4

Replace this:


$msg .= "Your Name: $sender_name\n";
$msg .= "Your E-Mail: $sender_email\n";
$msg .= "Subject: $subject\n\n";
$msg .= "Summary: $message\n\n";

With this


$sender_name = $_POST['sender_name'];
$sender_email = $_POST['sender_email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$msg .= "Your Name: $sender_name\n";
$msg .= "Your E-Mail: $sender_email\n";
$msg .= "Subject: $subject\n\n";
$msg .= "Summary: $message\n\n";

Kaotik
March 12th, 2006, 01:21 PM
Thanks for your efforts, however with replacing the code you gave me it's still giving out the same result. Still sends an email with empty submitted data. ?? If it helps any, it's Bluehost I'm going through.
Okay I found out super globals are in fact turned off on their servers by default. Is there another way around this via the coding?

Voccart
March 12th, 2006, 01:41 PM
musst have been the old page because i see you posted your fla now.

i just downloaded your fla. could you tell me where the AS is placed, needed for sending the values to php ? :)

cant find it anywhere or im drunk ? :beer:

Kaotik
March 12th, 2006, 01:43 PM
Ahhhh finally, I got it! I found this...
http://blog.gosu.pl/comments.php?id_news=2
Then changed my code to:

$sender_name = $_GET['sender_name'];
$sender_email = $_GET['sender_email'];
$subject = $_GET['subject'];
$message = $_GET['message'];
$msg .= "Your Name: $sender_name\n";
$msg .= "Your E-Mail: $sender_email\n";
$msg .= "Subject: $subject\n\n";
$msg .= "Summary: $message\n\n";

using the $_GET super global instead of $_POST
It works perfect now.

Thanks for the kickstart Voccart, btw the AS is on the "actions" level in Scene 1 (I realized my scenes are labeled out of order but it's there)

Voccart
March 12th, 2006, 01:58 PM
:thumb: glad i could help