I have tried this code again and again
Posted: Fri Jul 07, 2006 3:13 pm
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.
$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);
?>