- Oct 19, 2000
- 17,860
- 4
- 81
I'm wanting to take the submitted values of a form to create a text file. Normally, the script will create a one line text file, but occassionally I'll need to submit this same one line a specified number of times in this same text file.
To achieve this, I was trying to use an IF to see if I have called for the submitted values to be repeated. If I have, then I'll call the fwrite function, specify my file handle variable that's set up, then I was trying to use a for loop to loop the code that writes that line to the text file.
It's not working, though, and I'm 100% sure that my syntax isn't correct, that's why I'm not even bothering posting it here. I've never attempted using a for in an fwrite function, so I don't know how it should be structured.
Can I get some help on this?
EDIT: After giving it some more thought and looking through some stuff, I'm thinking that I need to use a for loop to simply append the data instead of trying to do everything in one step. I may be right, I may be wrong, but that's what I'm going to try. I still appreciate any advice on the matter.
To achieve this, I was trying to use an IF to see if I have called for the submitted values to be repeated. If I have, then I'll call the fwrite function, specify my file handle variable that's set up, then I was trying to use a for loop to loop the code that writes that line to the text file.
It's not working, though, and I'm 100% sure that my syntax isn't correct, that's why I'm not even bothering posting it here. I've never attempted using a for in an fwrite function, so I don't know how it should be structured.
Can I get some help on this?
EDIT: After giving it some more thought and looking through some stuff, I'm thinking that I need to use a for loop to simply append the data instead of trying to do everything in one step. I may be right, I may be wrong, but that's what I'm going to try. I still appreciate any advice on the matter.