Help with a script...
Posted: Wed Mar 12, 2008 9:50 am
I am building a simple price calculator for a client's client... I had found a way to figure everything else out and get it all working, except for one part.
Let me explain the idea of the project first: The user is suppose to enter a password, and depending on the password that is entered, read a certain text file with prices. I used the file() command, that brings in every line as a new part of the array, I then used array_unshift to make the first line be 1 instead of zero. There is an admin area, where they can change the prices in the text file... but I would really like line numbers. I want the actual file to look like this:
1)1234
2)2345
BUT when its called to be echoed into the table, have it strip out the "number)" part... I tried to do a loop that striped out the first part using str_replace, but that only worked for 1-10... I have to up to 98. Can anyone help me find a way to do this? This is my first time writing in PHP (or anything) and I hate asking for help, but I have been looking everywhere for a solution, and I can't get one to work! Any help would be appreciated.
Let me explain the idea of the project first: The user is suppose to enter a password, and depending on the password that is entered, read a certain text file with prices. I used the file() command, that brings in every line as a new part of the array, I then used array_unshift to make the first line be 1 instead of zero. There is an admin area, where they can change the prices in the text file... but I would really like line numbers. I want the actual file to look like this:
1)1234
2)2345
BUT when its called to be echoed into the table, have it strip out the "number)" part... I tried to do a loop that striped out the first part using str_replace, but that only worked for 1-10... I have to up to 98. Can anyone help me find a way to do this? This is my first time writing in PHP (or anything) and I hate asking for help, but I have been looking everywhere for a solution, and I can't get one to work! Any help would be appreciated.