...

View Full Version : Flat File Problems



Jearb
01-25-2010, 08:55 PM
<?php
$fileName = "z" . $_POST['Keyword'] . ".txt";
$file = fopen($fileName,"w");

fwrite($file,$string);

$string = "Name: ". $_SESSION['name'] . "\nGender: " . $_SESSION['gender'] . "\nClass: " . $_SESSION['class'] . "\nGauld: " . $_SESSION['gold'] . "\nLocation: " . $_SESSION['location'] . "\nStrength: " . $_SESSION['str'];

fclose($file);
?>


All of the variables are pre-set. However, when I run the source, it creates a file but does not write to it. I am confused.

Is there something I'm doing wrong?

bdl
01-25-2010, 09:15 PM
Move $string up above the function call that uses it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum