Need some guidance about this program

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

I have tried this code again and again

Post by akimm »

nothing seems to write

$name with the extension txt as I direct it to, here is the debugged version of this code I posted before, however, It will won't write the $_POST['name'] . 'txt' like it's supposed to.

Code: Select all

<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<input name="name" type="text">
<input type="submit" name="submit">
</form>
<?php 
$name = $_POST['name'];
// $file = '/articles/article' . $name . '.txt' 
$file = basename(__FILE__). '/articles/' . $name . '.txt';

fopen($file, 'a+');
// start an iteration that will add 1,2,3,4,5,6 and so on to each article 
// added 
fwrite($file, $user);
fclose($handle);
?>
Post Reply