Question:
Why do I keep getting "Notice: Undefined index: uname in..." in my PHP page?
taishomarou
2010-10-02 17:31:50 UTC
I made a form in Flash.
With a "user name", "title", and "message" wherein users can input information, and click the "submit" button. Then I made a PHP page where it's supposed to output the inputted info, but I just keep getting this:

Notice: Undefined index: uname in C:\wamp\www\forumpost.php on line 5

Notice: Undefined index: topic in C:\wamp\www\forumpost.php on line 6

Notice: Undefined index: comment in C:\wamp\www\forumpost.php on line 7

This is what I put on the button in my form made in Flash:
on (release) {
getURL("http://localhost/forumpost.php", "", "POST");
}

I named my input texts "uname", "topic" and "comment".

And this is what I put on my PHP page named "forumpost.php":


$uname=$_POST["uname"];
$topic=$_POST["topic"];
$comment=$_POST["comment"];

echo "Welcome".$uname."
";
echo "Title:".$topic."
";
echo "Message:".$comment."
";
?>



How do I get it to output the info on the PHP page correctly? Help please. Thankyou. :(
Four answers:
mcmilliam
2016-11-01 06:36:59 UTC
Php Uname
2010-10-04 15:42:00 UTC
if you are using flash then you could have something wrong with your action script (in flash) that is not sending



$uname=$_POST['uname'];

$topic=$_POST['topic'];

$comment=$_POST['comment'];



and make sure you using the LoadVars function in flash. Below is a simple user name and password set up for flash. You can see the whole script at this guys site (not mine, just an example that i found that is easy to understand) http://flash-creations.com/notes/servercomm_loadvars.php



// create an instance of LoadVars to send data

var dataOut:LoadVars = new LoadVars();



function checkUser():Void {

dataOut.username = username.text;

dataOut.password = password.text;

dataOut.send("checkuser1.php", "newwin", "POST");

}



enterbtn.addEventListener("click", checkUser);
2010-10-02 18:33:12 UTC
We'd have to see the form, but apparently



$_POST["uname"];



is undefined, because "uname" is undefined. Same for "topic" and "comment". Do you have textboxes with those names in the form?
?
2016-11-16 13:33:18 UTC
i'm not a Beatles fan, and that i don't locate not something offensive approximately that music or them strains in any respect. He grew to become into only making a assertion approximately himself, or possibly even somebody else, that hit their woman be it a girl chum or spouse, which sorry to assert did take place extra in many situations returned then than it does to day, I ought to assert it befell returned then as much because it does to day, yet grew to become into excepted as in, human beings did not communicate approximately it that lots. And all Lennon did grew to become into carry it to the forefront, to allow human beings understand what is going on interior the international, and no person is doing something approximately it. yet he or the guy of their music is doing some thing approximately it, as he's stopped beating the girl and issues are turning out to be extra effective. i don't see not something incorrect with that for the time of any respect. i think of perhaps you're going overboard slightly with the music. So i assume you do in comparison to Hendrix taking pictures his previous woman and working off to Mexico. I wager she grew to become into overwhelmed many situations, before she grew to become into shot. Or the Rolling Stones, making a music approximately how stupid woman, a placed down on all women human beings, and that they've been ineffective. yet that's not the case. One consistently has to remember interior the 50s it grew to become into okay basic that adult adult males beat their woman, lady chum/spouse, and it additionally grew to become into authentic into the 60s, whilst human beings like the Beatles delivered it to the forefront. so as a music is going, it relatively is an amazing music, for this is open to what grew to become into happening on the time, and that it is likewise time to alter issues and make it extra effective. If i grew to become into afflicted via that music for that verse on my own, then i could be afflicted via over have the songs in my series. i'm comfortable with that. reason all it relatively is doing is telling me issues like that have been given to stop, and we ought to consistently start to make issues extra effective. wherein case he's doing. take care dave


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...