PHP Variable: Newbie Question

Hi,
I have a question regarding posting PHP variables using an HTML form…

I have a form, with checkboxes… each checkbox has a unique name… like… link1, link2, link3, etc…

When someone selects any combination of those checkboxes, and hits submit, it posts to the same page… so then I have $post_link1, $post_link2 etc…

I have a for loop like this:

for ($counter = 1; $counter <= $post_idmax; $counter++) {
$temp = “$post_link”."$counter";
echo “$temp”’;

}

Now, I need to pass the value of $post_link1 to temp… so I need to use the array coutner to recreate the variable name for $post_link1,2,3 etc…

It does not seem to be working… again the $post_link1,2,3 variables contains the data from the html form checkbox… so whether it was checked or not… if it was checked, it should return ON.

Can someone please help me with this? It is driving me crazy!

Thanks!

i’m not sure what u wanna do but maybe this points u in the right direction:
[php]for ($counter = 1; $counter <= $post_idmax; $counter++) {
if(isset($_POST[‘link’.$counter])) echo ‘link’.$counter.’=ON
’;
} [/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service