| Author |
dynamic $_POST - help please
|
|
| mr_burns 2004-11-24, 3:56 pm |
| 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
Burnsy
| |
| Alan Little 2004-11-24, 3:56 pm |
| Carved in mystic runes upon the very living rock, the last words of
mr_burns of comp.lang.php make plain:
> 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
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/
| |
| Ken Robinson 2004-11-24, 3:56 pm |
|
mr_burns wrote:
> 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
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.
Ken
| |
| Pedro Graca 2004-11-24, 8:56 pm |
| mr_burns wrote:
> 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
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/
== ** ## !! !! ## ** ==
TEXT-ONLY mail to the complete "Reply-To:" address ("My Name" <my@address> ) may
bypass the spam filter. I will answer all pertinent mails from a valid address.
| |
| mr_burns 2004-11-26, 4:01 am |
| Hi again,
Sorry, my mistake. I hadnt properly named the text box to link up with
the script. Thanks for the help anyway
Burnsy
|
|
|
|