Page 1 of 1

Manipulating certain variables from $_POST

Posted: Thu Jan 15, 2009 7:40 pm
by joerocket
Hi everyone,

I am new to PHP and am making an application to experiment with. What I am trying to make is pretty simple. It is a rating system, I have an HTML table that has a text box for a name, then three slect drop downs to "rate" different cataegories of the text on each row. ex:

<text box> <selection 1><selection 2><selection 3>
<text box 2><selection 1><selection 2><selection 3>

When you submit that page, it goes to a PHP page that gets the weighted average for the 3 values and displays it along with the name in a table, which is ordered by the averages.

My question is, what is the best way to seperate and manipulate the selection values from the $_POST array? If I print $_POST, i get something like this:

<text box value>
<selection 1 value>
<sel 2 val>
<sel 3 val>
<text box 2 value>

etc...

so how would I be able to seperate the selection values, average them, then combine them with the appropriate text box? I tried using the chunk function, breaking up $_POST every 4 lines, but that didnt help much. Do you think it be easier to put the selection values into a different sub array in $_POST?

The way I have it working right now works, but it doesnt use PHP to the full extent. The way I have it now, the averaging function individually references each selection box, so I can only use as many boxes as I put into the code. Seems pointless to use PHP in that way...lol

Looking forward to you guys suggestions...Im looking for more suggestions than specific code so I can try and figure it out myself :)

Thanks,

Ryan