# Saving data to a txt from flash

**URL:** <https://forum.kirupa.com/t/saving-data-to-a-txt-from-flash/245329>\
**Category:** Uncategorized\
**Created:** [November 28, 2007, 4:38pm UTC](https://forum.kirupa.com/t/saving-data-to-a-txt-from-flash/245329 "2007-11-28T16:38:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![revin](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@revin](https://forum.kirupa.com/u/revin)\
**Post date:** [November 28, 2007, 4:38pm UTC](https://forum.kirupa.com/t/saving-data-to-a-txt-from-flash/245329/1 "2007-11-28T16:38:08Z")

</div>

ok maybe this was asked before

but i have an array of variables i want to save to a txt

heres the php code

```php

<?php
$petdata = $_POST['petpost'];
$userid = ("count.txt");
$numid = file($userid);
$numid[0] ++;
$fp = fopen($userid , "w");
fputs($fp , "$numid[0]");
$ourFileName = "pet".$numid.".txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fputs($ourFileHandle , "petcode=".$petdata);
echo "pet ID # $numid[0] was created, please remember this for later or write it down someplace <BR><BR> <a href='http://gaiahost.freeweb7.com/pets/pet.php?petid=".$numid."' target='_blank'>Click here for your pet page</a>";
fclose($ourFileHandle);
fclose($fp);
?>

```

and heres the flash code

```auto

on(press) {
petpost= _root.eyecolor,_root.skincolor,_root.hairstyle;
getUrl("petcreation.php", 0, "POST");
}

```

i’m sure its an easy one to figure out for expert coders @\_@

and i was sure i didn’t mess up anywhere

the php writes a file called petarray.txt when its supposed to write something like pet1.txt pet2.txt etc etc

and inside the file it has nothing after the “petcode=”

i’m not sure where i went wrong, could somebody help please?

it would be much appreciated
