mekdonel Posted July 14, 2007 Share Posted July 14, 2007 Hi, I have a text file that list out several activation code aaaaa1 aaaaa2 aaaaa3 aaaaa4 aaaaa5 Then I will create a form which user will enter the line number of the text file to get the activation code. Eg user enter '2', so the system will pop out 'aaaaa2'. The Problem is I really stuck on how to get php call the line number in the text file. Any help will be grateful. Thanks Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted July 14, 2007 Share Posted July 14, 2007 Open the file using the file function like so: $line = file('path/to/file'); file opens up the file and puts each line in to an array, eg: $line[0] is line 1, $line[1] is line 2, $line[2] is line 3. Remember array indices start at 0 and not 1. Quote Link to comment Share on other sites More sharing options...
mekdonel Posted July 14, 2007 Author Share Posted July 14, 2007 thanks for the fast reply. Problem solved Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.