Jump to content

php flash form


triad

Recommended Posts

Hi guys

 

I am creating my first flash php form but I think there is something wrong with the php,

Can anyone help me please.

<?php
$headers  = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
$headers .= 'To: <[email protected]>' . "\r\n"; 
$headers .= 'From: web form<[email protected]>' . "\r\n"; 
$headers .= 'Reply-to: [email protected]' . "\r\n"; 
$data = "Name :". $_POST['name']." <br> 
Website : ".$_POST['website']." <br>  
Phone : ".$_POST['phone']." <br> 
Email : ".$_POST['email']." <br>
Message : ".$_POST['msg']; 

mail("[email protected]","web form","$data",$headers);  
?>

 

cheers guys

Link to comment
https://forums.phpfreaks.com/topic/160760-php-flash-form/
Share on other sites

Does this really need to be sent in html format?

 

<?php
$headers .= 'To: <[email protected]>' . "\r\n"; 
$headers .= 'From: web form<[email protected]>' . "\r\n"; 
$headers .= 'Reply-to: [email protected]' . "\r\n"; 
$data = "Name :". $_POST['name']." <br> 
Website : ".$_POST['website']." <br>  
Phone : ".$_POST['phone']." <br> 
Email : ".$_POST['email']." <br>
Message : ".$_POST['msg']; 

if(mail("[email protected]","web form","$data",$headers)) {
echo 'sent';
} else {
echo 'not sent';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848416
Share on other sites

The flash form submits to a php script so do i put in the php script

 

here is the sumission code in the flash

 

on (release)
{
// Check if Email is valid
    function checkemail(email)
    {
        var _loc2 = new String(email);
        var _loc1 = _loc2.split("@");
        if (_loc1.length != 2 || _loc1[1].indexOf(".") < 1)
        {
		// if email is invalid : Initial 'Email' and Show error message.
        	emailx.text = "E-mail";
            showerror("Invalid email address !!");
            return (false);
        }
        else
        {
            return (true);
        } // end else if
    } // End of the function
    function showerror(message)
    {
        gotoAndStop("error");
        error = message;
    } // End of the function

// Fileds verification
    if (name != "Your name" && name != "" && email != "E-mail" && email != "" && phone != "Phone" && phone != "" && address !="Address" && address !="" && msg != "Message" && msg != "")
    {
        if (checkemail(email))
        {
		// If all fields are valid; Send data by a php file "form.php"...
            loadVariables("http://www.triaduk.co.uk/dependants/form.php", "", "POST");
            showerror("Sending data...");
		//.. and initialise all fields.
            name = "Your name";
            email = "E-mail";
            phone = "Phone";
		website = "Website";
            msg = "Message";
		// Show message has been sent !
            error = "Your message has been sent";
        } // end if
    }
    else
    {
	// If Fields are invalid; show error message
        showerror("All fields are required");
    } // end else if
}


Link to comment
https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848435
Share on other sites

you mean like this

 

<?php
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL | E_STRICT);
$headers  = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
$headers .= 'To: <[email protected]>' . "\r\n"; 
$headers .= 'From: web form<[email protected]>' . "\r\n"; 
$headers .= 'Reply-to: [email protected]' . "\r\n"; 
$data = "Name :". $_POST['name']." <br> 
Website : ".$_POST['website']." <br>  
Phone : ".$_POST['phone']." <br> 
Email : ".$_POST['email']." <br>
Message : ".$_POST['msg']; 

mail("[email protected]","web form","$data",$headers);  
?>

Link to comment
https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848444
Share on other sites

Try it, if it workds happy days :) Though as my original post said you don't need the html headers for a simple email, and use \n instead of <br> if you use a plain text email;

 

<?php
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL | E_STRICT);
$headers .= 'To: <[email protected]>' . "\r\n"; 
$headers .= 'From: web form<[email protected]>' . "\r\n"; 
$headers .= 'Reply-to: [email protected]' . "\r\n"; 
$data = "Name :". $_POST['name']." \r\n
Website : ".$_POST['website']." \r\n  
Phone : ".$_POST['phone']." \r\n 
Email : ".$_POST['email']." \r\n
Message : ".$_POST['msg']; 

if(mail("[email protected]","web form","$data",$headers)) {
echo 'sent';
} else {
echo 'not sent'; 
?>

Link to comment
https://forums.phpfreaks.com/topic/160760-php-flash-form/#findComment-848446
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.