urtwithac Posted January 31, 2007 Share Posted January 31, 2007 Hey, i'm having a bit of trouble with a form i created in flash, having the PHP process the variables and send them to a text file, that i can then read.I have got somewhere atleast...Name: Undefined Address: Undefinedare what i get in my text file on my server, not what is actually typed in the form fields.If anyone could tell me why it's doing this, it'd be appriciated.Here's my code:PHP:[code]<?php $content = "Name:".$_POST["name"]." Address:".$_POST["address"]; $fp = fopen("myText.txt","wb"); fwrite($fp,$content); fclose($fp); ?>[/code] Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 31, 2007 Share Posted January 31, 2007 address is probably misspelled in your form.do print_r($_POST) to see what post vars exist. Quote Link to comment Share on other sites More sharing options...
urtwithac Posted January 31, 2007 Author Share Posted January 31, 2007 Hey and thanks for the reply.What do you mean exactly?I've not really done much with PHP except the odd e-mail form, most of my work is done in Action Script in Flash.Where am i going to be needing to change the PHP code? Quote Link to comment Share on other sites More sharing options...
Orio Posted January 31, 2007 Share Posted January 31, 2007 Can you show us the form?Orio. Quote Link to comment Share on other sites More sharing options...
urtwithac Posted January 31, 2007 Author Share Posted January 31, 2007 Here's the code that's on my submit button,my fields each have their own variable names:nameaddress[code]on (release) { writeLVs = new LoadVars(); writeLVs.name = Name.text; writeLVs.address = Address.text; writeLVs.send("writeData.php?uniqueID="+getTimer(),writeLVs,"$_POST");}[/code] Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 31, 2007 Share Posted January 31, 2007 $content = "Name:".$_POST["name"]." Address:".$_POST["address"];Name and Address must be capitalized, as that's how you did it in your flash. PHP is case-sensitive.Change to:$content = "Name:".$_POST["Name"]." Address:".$_POST["Address"]; Quote Link to comment Share on other sites More sharing options...
urtwithac Posted January 31, 2007 Author Share Posted January 31, 2007 Thanks, i just tried it, but i'm still getting "Undefined" instead of the text that has been input.Regards,Curt. Quote Link to comment Share on other sites More sharing options...
Orio Posted January 31, 2007 Share Posted January 31, 2007 I know nothing about flash, but I've made some googling .Are you sure it's supposed to be: [code]writeLVs.send("writeData.php?uniqueID="+getTimer(),writeLVs,"$_POST");[/code]And not[code]writeLVs.send("writeData.php?uniqueID="+getTimer(),writeLVs,"POST");[/code]Orio. Quote Link to comment Share on other sites More sharing options...
urtwithac Posted February 1, 2007 Author Share Posted February 1, 2007 I've tried that too, but no luck.Thanks for the replies guys :) Quote Link to comment Share on other sites More sharing options...
urtwithac Posted February 1, 2007 Author Share Posted February 1, 2007 I've had a bit of luck.I changed the instance names to Name.text and Address.text on my submit button.Now i no longer get "[i]Undefined[/i]" in my text file.I just get:Name: Address:Thanks guys.Curt. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 1, 2007 Share Posted February 1, 2007 i have used flash and know a tad about sending data from flash to php. from my experience it should be just POST not $_POST. they must have an instance name that flash will read and a var name that PHP can read.and what your doing there, using the LoadVars will load information from a PHP file. your actionscript should look like this:[code]on(release){var name = name; //these need to be defined for phpvar address = address; //these need to be defined for phpgetURL("writeData.php?uniqueID="+getTimer(), "_parent", "POST"); //the sending of the info. _parent is what window it opens in}[/code]hope that works for you. Quote Link to comment Share on other sites More sharing options...
urtwithac Posted February 1, 2007 Author Share Posted February 1, 2007 I'm affraid not, i'm getting exactly the same output, just Name: Address:PHP is not my thing, if you hadn't guessed. hehI really need to get this working though.Thanks for all of the help. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted February 1, 2007 Share Posted February 1, 2007 are you sure it didnt work. i tried it myself and it worked fine.make sure your text fields are Input Fields, make sure they have an instance name and a var. i have it working for me. Quote Link to comment Share on other sites More sharing options...
urtwithac Posted February 1, 2007 Author Share Posted February 1, 2007 I can't figure out why it isn't working, they're input fields, have both var and instance names.Although i'm getting "Name: Address:" in my text file, could it be permissions with CHMOD?i don't know. i'm out of ideas.Maybe i have the wrong instance and var names.Thanks again,Curt. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.