Jump to content

PHP write to file


urtwithac

Recommended Posts

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: Undefined

are 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]
Link to comment
https://forums.phpfreaks.com/topic/36500-php-write-to-file/
Share on other sites

Here's the code that's on my submit button,

my fields each have their own variable names:
name
address

[code]
on (release) {
writeLVs = new LoadVars();
writeLVs.name = Name.text;
writeLVs.address = Address.text;
writeLVs.send("writeData.php?uniqueID="+getTimer(),writeLVs,"$_POST");
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/36500-php-write-to-file/#findComment-173750
Share on other sites

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 php
var address = address; //these need to be defined for php

getURL("writeData.php?uniqueID="+getTimer(), "_parent", "POST"); //the sending of the info. _parent is what window it opens in
}
[/code]

hope that works for you.
Link to comment
https://forums.phpfreaks.com/topic/36500-php-write-to-file/#findComment-174475
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/36500-php-write-to-file/#findComment-174488
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.