dynamic $_POST - help please

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi there,

I am tryin to use a $_POST variable but the name of the form element
is dynamic. Below is the code I am tryin but is obviously wrong as it
isnt working:

$abc = $_POST['abc_' . $value]; //isnt working as is

If $value had a value of 44, the above code would be represented as:

$abc = $_POST['abc_44'];

As I require that the line be quite generic to whatever the value of
$value is, I need to do it like the first snippet. What is the correct
way of writting this? Cheers


Re: dynamic $_POST - help please

mr_burns wrote:
Quoted text here. Click to load it

That should work.

What isn't working?  Dump your $_POST array and see if what you're
looking for is really there.
Show us the real code that isn't working. Or a URL of an example.


Re: dynamic $_POST - help please

Carved in mystic runes upon the very living rock, the last words of
mr_burns of comp.lang.php make plain:

Quoted text here. Click to load it

There's no reason that shouldn't work, assuming there actually is a key in
$_POST with that value. Why not try dumping it and see?

Alan Little
Phorm PHP Form Processor
http://www.phorm.com /

Re: dynamic $_POST - help please

mr_burns wrote:
Quoted text here. Click to load it

Why isn't it working?
What did you expect that to put into $abc?
What did that put into $abc?
How did you test?

Post some more code, please.

The reason that is not working /may be/ something else ...

Mail sent to my "From:" address is publicly readable at http://www.dodgeit.com /
== ** ## !!                                                         !! ## ** ==
bypass the spam filter. I will answer all pertinent mails from a valid address.

Re: dynamic $_POST - help please

Hi again,

Sorry, my mistake. I hadnt properly named the text box to link up with
the script. Thanks for the help anyway


Site Timeline