delightedx3
Active Member
Hey guys,
at school I now got into php in informatics.
Our job is to create homepage with a survey in it. The homepage ain't the problem as I know html and that stuff.
So I have to put a question and let the user choose 4 answers via radio buttons. Let's assume that the Answers are A,B,C and D.
Now the teacher asked me to safe the answers in a file, which ain't a problem, too.
The way I do that is the following:
I create a form with a submit button. On the site reffered in action="" I created an array with the answers A,B, C and D. The radio buttons do have a value which is transmitted.
So 'till now I don't have a problem to write the answer of a user in a file, but my big problem is to evaluate the results.
So my question is:
Is there a way php can browse every line of a file and count how often A appears or B, C or D?
I need to show the results of the survey through the width of a table or a div, but that ain't a big deal once I got the value. The best thing would be percentage.
Is there anyone willing to help me? I would really appreciate it as it won't be a big deal for php-pros out there.
Thanks in advance.
Regards,
at school I now got into php in informatics.
Our job is to create homepage with a survey in it. The homepage ain't the problem as I know html and that stuff.
So I have to put a question and let the user choose 4 answers via radio buttons. Let's assume that the Answers are A,B,C and D.
Now the teacher asked me to safe the answers in a file, which ain't a problem, too.
The way I do that is the following:
I create a form with a submit button. On the site reffered in action="" I created an array with the answers A,B, C and D. The radio buttons do have a value which is transmitted.
So 'till now I don't have a problem to write the answer of a user in a file, but my big problem is to evaluate the results.
So my question is:
Is there a way php can browse every line of a file and count how often A appears or B, C or D?
I need to show the results of the survey through the width of a table or a div, but that ain't a big deal once I got the value. The best thing would be percentage.
Is there anyone willing to help me? I would really appreciate it as it won't be a big deal for php-pros out there.
Thanks in advance.
Regards,