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: <design@triaduk.co.uk>' . "\r\n"; 
$headers .= 'From: web form<design@triaduk.co.uk>' . "\r\n"; 
$headers .= 'Reply-to: design@triaduk.co.uk' . "\r\n"; 
$data = "Name :". $_POST['name']." <br> 
Website : ".$_POST['website']." <br>  
Phone : ".$_POST['phone']." <br> 
Email : ".$_POST['email']." <br>
Message : ".$_POST['msg']; 

mail("design@triaduk.co.uk","web form","$data",$headers);  
?>

 

cheers guys

Link to comment
Share on other sites

Does this really need to be sent in html format?

 

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

if(mail("design@triaduk.co.uk","web form","$data",$headers)) {
echo 'sent';
} else {
echo 'not sent';
}
?>

Link to comment
Share on other sites

On the same HTML page as the form like so

 

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
ini_set('display_errors', 1);
ini_set('error_reporting', E_ALL | E_STRICT);
</head>

Link to comment
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
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: <design@triaduk.co.uk>' . "\r\n"; 
$headers .= 'From: web form<design@triaduk.co.uk>' . "\r\n"; 
$headers .= 'Reply-to: design@triaduk.co.uk' . "\r\n"; 
$data = "Name :". $_POST['name']." <br> 
Website : ".$_POST['website']." <br>  
Phone : ".$_POST['phone']." <br> 
Email : ".$_POST['email']." <br>
Message : ".$_POST['msg']; 

mail("design@triaduk.co.uk","web form","$data",$headers);  
?>

Link to comment
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: <design@triaduk.co.uk>' . "\r\n"; 
$headers .= 'From: web form<design@triaduk.co.uk>' . "\r\n"; 
$headers .= 'Reply-to: design@triaduk.co.uk' . "\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("design@triaduk.co.uk","web form","$data",$headers)) {
echo 'sent';
} else {
echo 'not sent'; 
?>

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.