pugboy Posted June 7, 2008 Share Posted June 7, 2008 I am creating a script to display a dropdown filled with stuff from my text file... This is the code I have: <? $fileName = "./name.txt"; $fh = fopen($fileName, 'r'); $exists = file_exists($fileName); echo $exists; $nameB = fread($fh, filesize($fileName)); echo $nameB; fclose($fh); $name = explode("\n",$nameB); $fileName = "./var.txt"; $fh = fopen($fileName, 'r'); $varB = fread($fh, filesize($fileName)); fclose($fh); $var = explode("\n",$varB); for ( $id = 0; $id <= $maxid; $id += 1) { echo "<option value='$var[$id]'>$name[$id]</option>"; } ?> A lot of the code is just for debugging, and nothing is echoed at all... My directories are like this: home directory -name.txt -var.txt -UserCP --add.php (The code above) Why is nothing displayed? Do I have the file names set correctly? Quote Link to comment Share on other sites More sharing options...
digitalgod Posted June 7, 2008 Share Posted June 7, 2008 try <? $fileName = "../name.txt"; $fh = fopen($fileName, 'r'); $exists = file_exists($fileName); echo $exists; $nameB = fread($fh, filesize($fileName)); echo $nameB; $name = explode("\n",$nameB); fclose($fh); $fileName = "../var.txt"; $fh = fopen($fileName, 'r'); $varB = fread($fh, filesize($fileName)); $var = explode("\n",$varB); for ( $id = 0; $id <= $maxid; $id += 1) { echo "<option value='$var[$id]'>$name[$id]</option>"; } fclose($fh); ?> Quote Link to comment Share on other sites More sharing options...
pugboy Posted June 7, 2008 Author Share Posted June 7, 2008 Ok, thanks I thought it was only 1 period... 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.