I’m new to PHP and I’m currently been assigned a project to create a form generator where I will have a PHP script that will read a text file eg. ?svcreq.form? and print a html form. The sample contents of the file is as follow.
formname=form1 label=Server Request Form Header=Server Requirementtype=radio
label=Server
options=hpux,linux,windows
label=HPUX,LINUX,Windowstype=checkbox
label=Optional accessory
options=cddrive,tapedrive
label=CD Drive,Tape DriveHeader=Requestor Info
type=text
label=Name
properties=maxlength|20,length|23
The 1 above is the text file and the PHP script will have to automatically generate the form according to the fields given. I will have to write a PHP script that will read that file. My question is:
- Can I write a PHP script that will read the text file line by line? Or are there any other options to do this?
- I’ve been going through a lot of books, but I just can’t find an example on how to do this.
Please help and your help will highly appreciated. Thank you in advance.