Getting the POST with a variable

[php]echo $_POST[$myval];[/php]

I know this doesn’t work, cause I tried it. Is there an alternative you can think of? I need to get the string from myval into the post so it gets that posted data.

You want to store a variable’s value into POST super global??? but why?

I don’t think so? See, what happens is I have this long script that loops the number of times that there are users on my site. It posts the selected users’ checkbox values to “select1, select2, select3,etc” by simply setting the name of the checkbox to:
[php]name=“select<?php echo $i ?>”[/php]

However, I can’t do the same to load the data because I can’t find a way to input that select# string into the $_POST[] bit so that it knows which posted variable to access.

(So that it knows which users the selected operation is being done to)

Turns out I was just being a dummy, it does work. I don’t even know how it happened! Thanks anyway.

well, to answer the question, it would be $_POST[‘var_name’] = $myval;

I do this all the time when i’m troubleshooting a script, so that I can control the input a lot easier than having to fill out a form each time.

Sponsor our Newsletter | Privacy Policy | Terms of Service