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 #176164 is a reply to message #176161] Mon, 28 November 2011 12:27 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 11/28/2011 5:33 AM, Jesolo Sun wrote:
> Hi
> is not possible because in the first page i use this values in
> Javascript functions for example : calculate(numero_99_300, 99, 300);
> this input
> <INPUT style="width: 130px;" id="99_300_numero0" onChange="if
> (this.value < min_numero_per_calcolare) { $(window).humanMsg('Minimal,
> total quantity of products has to be: ' + min_numero_per_calcolare + '
> pcs.'); this.value = ''; return false
> }change_colour('99','300','0',this);document.getElementById('99_300_il0').v alue
> = this.value;cambio_pagamento('99','300');calculate(numero_99_300, 99,
> 300);"
> class="formfield"
> name="product_data[99][300][numero0]" type="text">

I agree with Erwin that using hidden fields will solve your problem, and
I see no reason they should affect your javascript. It would require
the least modification to your page. Using PHP's array functions is
also a solution.

A good start would be to check out foreach(), i.e.

foreach($array = $key=>$value)

You could use this as

foreach ($_POST['product_data'] as $product_id=>$prod_data)
foreach ($prod_data as $product_variant=>$variant_data)

But I also think your approach can be confusing. Better I would think
would be to just use product_data[0], product_data[1], etc, with a
hidden field containing id, i.e.

<input type="hidden" name="product_data[0][id]" value="99"> (product id)
<input type="hidden" name="product_data[0][0]" value="300"> (variant)
<INPUT id="99_300_prezzo0" name="product_data[0][0][0]"
readOnly="readonly" type="text"> (value for prezzo0)
<INPUT id="99_300_prezzo1" name="product_data[0][0][1]"
readOnly="readonly" type="text"> (value for prezzo1)

And so on.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[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:23:06 GMT 2024

Total time taken to generate the page: 0.03332 seconds