Ranger56
08-29-2006, 11:41 PM
http://spiderseatbabies.com/test/
When I submit the form I want it to add the number to whatever is in the text file.
So if I put 4 into the form, and 46 was in the text file, it would go to 50 instead of 4.
index.php
<?php
$file = "m.txt";
$file_open = fopen($file, 'a+');
$theData = fread($file_open, filesize($file));
echo $theData;
?>
form.php
<?php
$file = "m.txt";
$somecontent = $_GET['add'];
if (is_writable($file)) {
if (!$handle = fopen($file, 'w+')) {
echo "Cannot open file ($file)";
exit;
}
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($file)";
exit;
}
echo "Added ($somecontent)";
fclose($handle);
} else {
echo "The file $file is not writable";
}
?>
When I submit the form I want it to add the number to whatever is in the text file.
So if I put 4 into the form, and 46 was in the text file, it would go to 50 instead of 4.
index.php
<?php
$file = "m.txt";
$file_open = fopen($file, 'a+');
$theData = fread($file_open, filesize($file));
echo $theData;
?>
form.php
<?php
$file = "m.txt";
$somecontent = $_GET['add'];
if (is_writable($file)) {
if (!$handle = fopen($file, 'w+')) {
echo "Cannot open file ($file)";
exit;
}
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($file)";
exit;
}
echo "Added ($somecontent)";
fclose($handle);
} else {
echo "The file $file is not writable";
}
?>