FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Associative Array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Associative Array [message #176160 is a reply to message #176158] Mon, 28 November 2011 10:11 Go to previous messageGo to previous message
Erwin Moller is currently offline  Erwin Moller
Messages: 228
Registered: September 2010
Karma:
Senior Member
On 11/28/2011 10:41 AM, Jesolo Sun wrote:
> ?
>
> I'm sorry, Jesolo, I understand English isn't your first language and
> you're trying to communicate your problem. But reading through both of
> your posts again, I'm just not understanding what your problem is.
>
> The data is in your $_POST array, and all accessible to your script.
> You do have multiple dimensional arrays in your $_POST array, but you
> access it similar to in your HTML, i.e.
>
> $val0 = $_POST['product_data'][99][300]['prezzo0']; // 2.20
> $val1 = $_POST['product_data'][99][300]['prezzo1']; // empty string
>
> and so on.
>
> Is this your problem?
>
>
>
> Dear sirs
> i have used this and get the values
> my problem is the values in the POST, the value [99] is dynamics ( this is
> ProductID) and [300] is dynamics ( this is Product variant)
> For every product i have different ProductID and different Product variant

Hi,

You can solve this in different ways.
The easiest is probably sending the values for ProductID and "Product
variant".

So in your form add:
<INPUT type="hidden" name="productid"
value="<?php echo $usedproductid; ?>">
<INPUT type="hidden" name="productvariant"
value="<?php echo $usedproductvariant; ?>">

Of course, use something sensible for $usedproductid and
$usedproductvariant.

Next, from your receiving script:
$productid = (int)$_POST["productid"];
$productvariant = (int)$_POST["productvariant"];

and use them by replacing the 99 and 300 in the original (form Jerry's
example):

$val0 = $_POST['product_data'][$productid ][$productvariant]['prezzo0'];
// 2.20
$val1 = $_POST['product_data'][$productid ][$productvariant]['prezzo1'];
// empty string

Regards,
Erwin Moller

--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Order/Timing of Execution of PHP
Next Topic: Browser doesn't support
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 08:27:30 GMT 2024

Total time taken to generate the page: 0.03557 seconds