php notice : undefined index
i am getting this error
Notice: Undefined index: firstName in C:\xampp\htdocs\flasblog\test.php on line 3
Notice: Undefined index: lastName in C:\xampp\htdocs\flasblog\test.php on line 3
here is my php code
<?php include_once"scripts/connect.php"; ?>
<?php
$text=$_POST['firstName']." ".$_POST['lastName'];
$to="anubhavjhalani09@gmail.com";
$subject="Message from php";
//data insert into database
$sql="INSERT INTO entries (contents)
VALUES
('$text')";
echo $text;
?>
please somebody help me !!!!!!!!! i know how to hide this error but its not the solution of this problem.i am getting the variables from a flash file which is in the same folder.
aaloo
Junior Poster in Training
76 posts since Oct 2011
Reputation Points: 22
Solved Threads: 0
thanx for the reply
now i am getting this
Post:Array ( ) Get: Array ( )
Notice: Undefined index: firstName in C:\xampp\htdocs\flasblog\test.php on line 5
Notice: Undefined index: lastName in C:\xampp\htdocs\flasblog\test.php on line 5
my php script is
<?php include_once"scripts/connect.php"; ?>
<?php
echo "Post:".print_r($_POST,true);
echo "Get: ".print_r($_GET,true);
$text=$_POST['firstName']." ".$_POST['lastName'];
$to="anubhavjhalani09@gmail.com";
$subject="Message from php";
//data insert into database
$sql="INSERT INTO entries (contents)
VALUES
('$text')";
echo $text;
?>
now what does it mean ??
aaloo
Junior Poster in Training
76 posts since Oct 2011
Reputation Points: 22
Solved Threads: 0
Try this:
if(isset($_POST['firstName'] && $_POST['lastName'])) {
$text=$_POST['firstName']." ".$_POST['lastName'];
$to="anubhavjhalani09@gmail.com";
$subject="Message from php";
//data insert into database
$sql="INSERT INTO entries (contents)
VALUES
('$text')";
echo $text;
}
Zero13
Practically a Master Poster
624 posts since Jan 2009
Reputation Points: 120
Solved Threads: 139
heyy i just play my flash movie and then i check the test.php page on browser and then i am getting this error .is this the right way to send variables to php by just playing the flash movie?????my fla , swf and php file is in the same folder
aaloo
Junior Poster in Training
76 posts since Oct 2011
Reputation Points: 22
Solved Threads: 0
@zero13
i tried your code . now i m getting this error
Parse error: syntax error, unexpected T_BOOLEAN_AND, expecting ',' or ')' in C:\xampp\htdocs\flasblog\test.php on line 3
my php code is
<?php include_once"scripts/connect.php"; ?>
<?php
if(isset($_POST['firstName'] && $_POST['lastName'])) {
$text=$_POST['firstName']." ".$_POST['lastName'];
$to="anubhavjhalani09@gmail.com";
$subject="Message from php";
//data insert into database
$sql="INSERT INTO entries (contents)
VALUES
('$text')";
echo $text;
}
?>
now what to do ??? and also look at my question above
aaloo
Junior Poster in Training
76 posts since Oct 2011
Reputation Points: 22
Solved Threads: 0
No. You don't play a flash movie and then visit another page. A form, be it from html or flash, must be submitted and pass information to a script. The POST is passed within the request the browser makes to the web server when calling the form handler.
please write your answer in simple english . i am not a native english speaker
aaloo
Junior Poster in Training
76 posts since Oct 2011
Reputation Points: 22
Solved Threads: 0