Page 1 of 1

Keeping track

Posted: Tue Oct 07, 2008 1:11 am
by bluewalrus
I've never written my own php i just started looking at php this past week and it looks similar to basic. So...I have a form on a page and is submitting to threw a php page i want the php page to number each submission so i created a txt file called "number" that text file only has a 0 in it. I think i wrote this code below so that it opens the text file reads the 0 adds one to it and then saves and closes it. If this code is correct for that then the only question i have is how do i call it back so i can reference it back on the form page to say the number that has been submitted? I'm gonna change the page to a php cause i can display html and css in that page the same correct?

Code: Select all

 
<?php
$num = "number.txt";
$increase = fopen($num, 'w');
$val = ($num + 1);
fwrite($increase, $val);
fclose($increase);
?>
 
Thanks for any suggestions you have.

Re: Keeping track

Posted: Tue Oct 07, 2008 2:28 am
by papa
Well first of all $val is saying: number.txt + 1

Look at file_get_contents and give it another shoot.