this is my code

<?php

$subject = $_POST['senderName'];
$message = $_POST['senderMsg'];


echo $subject;
?>

and i m getting this error


Notice: Undefined index: senderName in C:\xampp\htdocs\flasblog\mail.php on line 3

Notice: Undefined index: senderMsg in C:\xampp\htdocs\flasblog\mail.php on line 4

Recommended Answers

This means that those keys - 'senderName' and 'senderMsg' - do not exist in the $_POST array. You have to set the post keys with the name tag in your form.

<input type="text" name="senderName" />
Jump to Post

http://www.flepstudio.org/forum/tutorials/3319-creating-email-form-actionscript-3-0-php.html

Take a look at that - particularly:

var request:URLRequest=new URLRequest();

request.url='sendMail.php';

request.method=URLRequestMethod.POST;

request.data=variables;

Try putting this in your php code and comment out the stuff in the first post, and see what it gives you:

print_r($_POST);

If it's empty, you …

Jump to Post

All 5 Replies

This means that those keys - 'senderName' and 'senderMsg' - do not exist in the $_POST array. You have to set the post keys with the name tag in your form.

<input type="text" name="senderName" />

noo.. i m using flash action script 3 and this is my code

var my_vars:URLVariables = new URLVariables();
my_vars.senderName = name_txt.text;

my_vars.senderMsg = message_txt.text;

http://www.flepstudio.org/forum/tutorials/3319-creating-email-form-actionscript-3-0-php.html

Take a look at that - particularly:

var request:URLRequest=new URLRequest();

request.url='sendMail.php';

request.method=URLRequestMethod.POST;

request.data=variables;

Try putting this in your php code and comment out the stuff in the first post, and see what it gives you:

print_r($_POST);

If it's empty, you aren't sending the variables with flash properly.

this is my code and this is fully working in flash ..i think there is a problem in my php code ...wht u say ??

trace("Mouse clicked");
	var my_vars:URLVariables = new URLVariables();
my_vars.senderName = name_txt.text;

my_vars.senderMsg = message_txt.text;
	// End your custom code
	var my_url:URLRequest = new URLRequest("mail.php");
my_url.method = URLRequestMethod.POST;
my_url.data = my_vars;
	var my_loader:URLLoader = new URLLoader();
my_loader.dataFormat = URLLoaderDataFormat.VARIABLES;
my_loader.load(my_url);

name_txt.text = "";
message_txt.text = "Message Sent";

Try the print_r suggestion in my previous post so that we know.
If you can't see the output directly because you're loading the php file with flash, put this in your php file and post the contents of output.txt:

file_put_contents("output.txt", print_r($_POST));
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.