Hello and thank you so much - I haven't written a program since the 90s and this is awesome, I wanted to ask a few questions.
First of all - I couldn't get the line "$handle = fopen('text.txt', 'a')" to work without putting the a inside inverted commas. Is that normal?
Second, when I save the file, it doesn't write over itself but the text is added to the back end of the file; in other words if I save four different sentences, one at a time, the text file retains them all, is that correct? Thx
@flash4real Ah, thank you thank you. I gotta say I'm really enjoying this. The last program I wrote was in AppleBasic heh - this is fantastic, to be learning to code again. Thank you.
@flash4real Using 'w' doesnt seem to change a thing for me in regards to overwriting the txt file. 'a' and 'w' do the same thing for me or atleast it seems that way. Am I doing something wrong?
@TsumiESM I had the same issue with the variable a first ,it gave me error code of an undefined variable for a if I didnt put it in inverted commas('a'). Is it supposed to constantly rewrite over the same txt file?
How would I get it to work with a form that takes a name and last name. Seems easier with one text field but with two I can't figure it out. I also would need it to print the first and last name into a text document
yep, can´t make it work either
LusoCMD 5 months ago
does not work
lurviQ 9 months ago
Hello and thank you so much - I haven't written a program since the 90s and this is awesome, I wanted to ask a few questions.
First of all - I couldn't get the line "$handle = fopen('text.txt', 'a')" to work without putting the a inside inverted commas. Is that normal?
Second, when I save the file, it doesn't write over itself but the text is added to the back end of the file; in other words if I save four different sentences, one at a time, the text file retains them all, is that correct? Thx
TsumiESM 10 months ago
@TsumiESM Yes, the 'a' should be in inverted commas.
Different letters do different things - 'a' appends to the file. If you want it to overwrite, use 'w' instead.
flash4real 10 months ago
@flash4real Ah, thank you thank you. I gotta say I'm really enjoying this. The last program I wrote was in AppleBasic heh - this is fantastic, to be learning to code again. Thank you.
TsumiESM 10 months ago
@flash4real Using 'w' doesnt seem to change a thing for me in regards to overwriting the txt file. 'a' and 'w' do the same thing for me or atleast it seems that way. Am I doing something wrong?
gabriellippincott10 2 months ago
@gabriellippincott10
Here are the different modes:
r - read
r+ - read, write, prepend
w - write, truncate
w+ - read, write, truncate
a - write, append
a+ - read, write, append
flash4real 2 months ago
@TsumiESM I had the same issue with the variable a first ,it gave me error code of an undefined variable for a if I didnt put it in inverted commas('a'). Is it supposed to constantly rewrite over the same txt file?
gabriellippincott10 2 months ago
It dont works with /a ..... only, with "a"
$handle = fopen('text.txt' , "a");
But if I enter the text, it saves it, but if i leave the field emptyt it wrote: Your file has been saved.
What should be the problem?
peromajstore 1 year ago
have you attempted it? send me the code i'll take a look at it.
flash4real 2 years ago
How would I get it to work with a form that takes a name and last name. Seems easier with one text field but with two I can't figure it out. I also would need it to print the first and last name into a text document
Knk082 2 years ago