Hi,
I'm trying to check a txt file for a user inputed field before submitting a form. If the ID exists process the form if not go to error. I originally had it setup where each ID record was a seperate .txt file but just recently combined all the files to one txt file so now I'm not sure how to check one file. This works fine for the old setup:
&error('Not valid.') unless (open(FILE, "/pathto/$form{'ID'}.txt"));
But now the new file is just one pipe deliminated file similar to links:
1|more info|and more info
2|more info|and more info
3|more info|and more info
So I need to check the first field of each record (to make sure it matches what the user inputs) so using the example above, if the user inputs an ID of 2 it will process but if they enter 4 they'll go to the error page.....but not quite sure how to do it. Any ideas? Thanks.
I'm trying to check a txt file for a user inputed field before submitting a form. If the ID exists process the form if not go to error. I originally had it setup where each ID record was a seperate .txt file but just recently combined all the files to one txt file so now I'm not sure how to check one file. This works fine for the old setup:
&error('Not valid.') unless (open(FILE, "/pathto/$form{'ID'}.txt"));
But now the new file is just one pipe deliminated file similar to links:
1|more info|and more info
2|more info|and more info
3|more info|and more info
So I need to check the first field of each record (to make sure it matches what the user inputs) so using the example above, if the user inputs an ID of 2 it will process but if they enter 4 they'll go to the error page.....but not quite sure how to do it. Any ideas? Thanks.