Associative Array [message #176142] |
Sat, 26 November 2011 00:37 |
Jesolo Sun
Messages: 8 Registered: November 2011
Karma: 0
|
Junior Member |
|
|
I have variuous selectbox a inputbox radio e checkbox
<INPUT id="99_300_prezzo0" name="product_data[99][300][prezzo0]"
readOnly="readonly" type="text">
<INPUT id="99_300_prezzo1" name="product_data[99][300][prezzo1]"
readOnly="readonly" type="text">
<INPUT id="99_300_prezzo2" name="product_data[99][300][prezzo2]"
readOnly="readonly" type="text">
Check this data from $_POST
print_r ($_POST);
and wtite :
Array ( [product_data] =>
Array ( [99] =>
Array ( [300] =>
Array ( [prezzo0] => 2.20
[prezzo1] =>
[prezzo2] =>
[prezzocal0] => 238.03
[prezzocal1] =>
[prezzocal2] =>
[numero0] => 108
[numero1] =>
[numero2] =>
[color] => 64
[tipo_stampa] => 4_0
[il_colore0] => 1
[il_colore1] => 1
[il_colore2] => 1
[adornment] =>
Array ( [0] => 11 [1] => 12 )
[pacchetto_id] => 136#P_701
[colorepack] => 74#P_701_E
[realization_period] => N ) ) ) [submit] => Conferma ordine )
$array = $_POST;
for ($i=0;$i<count($array)-1;$i++)
{
for ($a=$i+1;$a<count($array);$a++)
{
for ($b=$i+1;$b<count($array);$b++)
{
for ($c=$i+1;$c<count($array);$c++)
{
print $Colore = $_POST['color']."<br>";
$ordina = strcmp($array[$i]["device"], $array[$c]["device"]);
if ($ordina > 0)
{
$ordinato = $array[$i];
$array[$i] = $array[$a];
$array[$a] = $array[$b];
$array[$b] = $array[$c];
$array[$c] = $ordinato;
}
}
}
}
}
echo "<pre>\n";
print_r($array);
echo "</pre>\n";
Array
(
[product_data] => Array
(
[99] => Array
(
[300] => Array
(
[prezzo0] => 2.22
[prezzo1] =>
[prezzo2] =>
[prezzoAa0] => 239.26
[prezzocal1] =>
[prezzocal2] =>
[numero0] => 108
[numero1] =>
[numero2] =>
[color] => 39
[tipo_stampa] => 4_1
[il_colore0] => 1
[il_colore1] => 1
[il_colore2] => 1
[ad_adornment] => Array
(
[0] => 11
[1] => 13
)
[pacchetto_id] => 136#P_701
[colorepack] => 45#P_701_D
[realization_period] => N
)
)
)
[submit] => Conferma ordine )
5 Array ...
How do I recover my data to manage them?
|
|
|
Re: Associative Array [message #176143 is a reply to message #176142] |
Sat, 26 November 2011 00:55 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 11/25/2011 7:37 PM, Jesolo Sun wrote:
>
> I have variuous selectbox a inputbox radio e checkbox
> <INPUT id="99_300_prezzo0" name="product_data[99][300][prezzo0]"
> readOnly="readonly" type="text">
> <INPUT id="99_300_prezzo1" name="product_data[99][300][prezzo1]"
> readOnly="readonly" type="text">
> <INPUT id="99_300_prezzo2" name="product_data[99][300][prezzo2]"
> readOnly="readonly" type="text">
>
> Check this data from $_POST
> print_r ($_POST);
>
> and wtite :
> Array ( [product_data] =>
> Array ( [99] =>
> Array ( [300] =>
> Array ( [prezzo0] => 2.20
> [prezzo1] =>
> [prezzo2] =>
> [prezzocal0] => 238.03
> [prezzocal1] =>
> [prezzocal2] =>
> [numero0] => 108
> [numero1] =>
> [numero2] =>
[color=blue]> => 64
> [tipo_stampa] => 4_0
> [il_colore0] => 1
> [il_colore1] => 1
> [il_colore2] => 1
> [adornment] =>
> Array ( [0] => 11 [1] => 12 )
> [pacchetto_id] => 136#P_701
[color=blue]> [colorepack] => 74#P_701_E[/color]
> [realization_period] => N ) ) ) [submit] => Conferma ordine )
>
>
>
> $array = $_POST;
>
> for ($i=0;$i<count($array)-1;$i++)
> {
>
> for ($a=$i+1;$a<count($array);$a++)
> {
> for ($b=$i+1;$b<count($array);$b++)
> {
>
> for ($c=$i+1;$c<count($array);$c++)
> {
> print $Colore = $_POST['color']."<br>";
> $ordina = strcmp($array[$i]["device"], $array[$c]["device"]);
> if ($ordina > 0)
> {
> $ordinato = $array[$i];
> $array[$i] = $array[$a];
> $array[$a] = $array[$b];
> $array[$b] = $array[$c];
> $array[$c] = $ordinato;
> }
> }
> }
> }
> }
>
> echo "<pre>\n";
> print_r($array);
> echo "</pre>\n";
>
>
> Array
> (
> [product_data] => Array
> (
> [99] => Array
> (
> [300] => Array
> (
> [prezzo0] => 2.22
> [prezzo1] => [prezzo2] => [prezzoAa0] => 239.26
> [prezzocal1] => [prezzocal2] => [numero0] => 108
[color=blue]> [numero1] => [numero2] => => 39
> [tipo_stampa] => 4_1
> [il_colore0] => 1
> [il_colore1] => 1
> [il_colore2] => 1
> [ad_adornment] => Array
> (
> [0] => 11
> [1] => 13
> )
>
[color=blue]> [pacchetto_id] => 136#P_701 [colorepack] => 45#P_701_D[/color]
> [realization_period] => N
> )
>
> )
>
> )
>
> [submit] => Conferma ordine )
>
>
> 5 Array ...
> How do I recover my data to manage them?
>
>
>
I don't understand your problem. Please forget the code and state it
succinctly. It will be much easier for us to help you.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: Associative Array [message #176144 is a reply to message #176143] |
Sat, 26 November 2011 08:01 |
Jesolo Sun
Messages: 8 Registered: November 2011
Karma: 0
|
Junior Member |
|
|
"Jerry Stuckle" ha scritto nel messaggio news:japdds$g99$1(at)dont-email(dot)me...
On 11/25/2011 7:37 PM, Jesolo Sun wrote:
SORRY......
Data FROM POST
print_r ($_POST);
Array ( [product_data] =>
Array ( [99] =>
Array ( [300] =>
Array ( [prezzo0] => 2.20
[prezzo1] =>
[prezzo2] =>
[prezzocal0] => 238.03
[prezzocal1] =>
[prezzocal2] =>
[numero0] => 108
[numero1] =>
[numero2] =>
[color] => 64
[tipo_stampa] => 4_0
[il_colore0] => 1
[il_colore1] => 1
[il_colore2] => 1
[adornment] =>
Array ( [0] => 11 [1] => 12 )
[pacchetto_id] => 136#P_701
[colorepack] => 74#P_701_E
[realization_period] => N ) ) ) [submit] => Conferma ordine )
I need this data
How?
|
|
|
Re: Associative Array [message #176145 is a reply to message #176144] |
Sat, 26 November 2011 10:01 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 11/26/2011 3:01 AM, Jesolo Sun wrote:
>
>
> "Jerry Stuckle" ha scritto nel messaggio news:japdds$g99$1(at)dont-email(dot)me...
>
> On 11/25/2011 7:37 PM, Jesolo Sun wrote:
>
>
> SORRY......
>
> Data FROM POST
> print_r ($_POST);
>
>
> Array ( [product_data] =>
> Array ( [99] =>
> Array ( [300] =>
> Array ( [prezzo0] => 2.20
> [prezzo1] =>
> [prezzo2] =>
> [prezzocal0] => 238.03
> [prezzocal1] =>
> [prezzocal2] =>
> [numero0] => 108
> [numero1] =>
> [numero2] =>
[color=blue]> => 64
> [tipo_stampa] => 4_0
> [il_colore0] => 1
> [il_colore1] => 1
> [il_colore2] => 1
> [adornment] =>
> Array ( [0] => 11 [1] => 12 )
> [pacchetto_id] => 136#P_701
[color=blue]> [colorepack] => 74#P_701_E[/color]
> [realization_period] => N ) ) ) [submit] => Conferma ordine )
>
> I need this data
> How?
The data is in your $_POST superglobal. Again, what's your problem?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: Associative Array [message #176148 is a reply to message #176144] |
Sat, 26 November 2011 12:55 |
Norman Peelman
Messages: 126 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 11/26/2011 03:01 AM, Jesolo Sun wrote:
>
>
> "Jerry Stuckle" ha scritto nel messaggio news:japdds$g99$1(at)dont-email(dot)me...
>
> On 11/25/2011 7:37 PM, Jesolo Sun wrote:
>
>
> SORRY......
>
> Data FROM POST
> print_r ($_POST);
>
>
> Array ( [product_data] =>
> Array ( [99] =>
> Array ( [300] =>
> Array ( [prezzo0] => 2.20
> [prezzo1] =>
> [prezzo2] =>
> [prezzocal0] => 238.03
> [prezzocal1] =>
> [prezzocal2] =>
> [numero0] => 108
> [numero1] =>
> [numero2] =>
[color=blue]> => 64
> [tipo_stampa] => 4_0
> [il_colore0] => 1
> [il_colore1] => 1
> [il_colore2] => 1
> [adornment] =>
> Array ( [0] => 11 [1] => 12 )
> [pacchetto_id] => 136#P_701
[color=blue]> [colorepack] => 74#P_701_E[/color]
> [realization_period] => N ) ) ) [submit] => Conferma ordine )
>
> I need this data
> How?
Like Jerry said, you have the data in $_POST. Do you need to know
what data is there?
I see you have a variable structure as:
$product_data[n][m][?]
.... so I assume you need to know what [n], [m] and [?] are when a user
submits the form. Take a look at the array functions:
http://us.php.net/manual/en/ref.array.php
http://us.php.net/manual/en/function.array-keys.php#73992
http://us.php.net/manual/en/function.array-keys.php#29165
--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
|
|
|
Re: Associative Array [message #176149 is a reply to message #176144] |
Sat, 26 November 2011 15:28 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 11/26/2011 3:01 AM, Jesolo Sun wrote:
>
>
> "Jerry Stuckle" ha scritto nel messaggio news:japdds$g99$1(at)dont-email(dot)me...
>
> On 11/25/2011 7:37 PM, Jesolo Sun wrote:
>
>
> SORRY......
>
> Data FROM POST
> print_r ($_POST);
>
>
> Array ( [product_data] =>
> Array ( [99] =>
> Array ( [300] =>
> Array ( [prezzo0] => 2.20
> [prezzo1] =>
> [prezzo2] =>
> [prezzocal0] => 238.03
> [prezzocal1] =>
> [prezzocal2] =>
> [numero0] => 108
> [numero1] =>
> [numero2] =>
[color=blue]> => 64
> [tipo_stampa] => 4_0
> [il_colore0] => 1
> [il_colore1] => 1
> [il_colore2] => 1
> [adornment] =>
> Array ( [0] => 11 [1] => 12 )
> [pacchetto_id] => 136#P_701
[color=blue]> [colorepack] => 74#P_701_E[/color]
> [realization_period] => N ) ) ) [submit] => Conferma ordine )
>
> I need this data
> How?
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?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: Associative Array [message #176158 is a reply to message #176149] |
Mon, 28 November 2011 09:41 |
Jesolo Sun
Messages: 8 Registered: November 2011
Karma: 0
|
Junior Member |
|
|
?
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
|
|
|
|
Re: Associative Array [message #176160 is a reply to message #176158] |
Mon, 28 November 2011 10:11 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma: 0
|
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
|
|
|
Re: Associative Array [message #176161 is a reply to message #176160] |
Mon, 28 November 2011 10:33 |
Jesolo Sun
Messages: 8 Registered: November 2011
Karma: 0
|
Junior Member |
|
|
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
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">
|
|
|
Re: Associative Array [message #176163 is a reply to message #176161] |
Mon, 28 November 2011 11:08 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 11/28/2011 11:33 AM, Jesolo Sun wrote:
>
>
> 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
>
[fixed posting somewhat. Please do *not* answer UNDER a sig. Use a
newsreader please.]
>
> 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 don't know how you set up you logic on the client.
But from the looks of it you are not experienced in Javascript. It looks
very messy to me. :-(
Anyway, if you want to solve it serverside you can also try something
like this:
Assuming you have the folowwing structure:
$_POST['product_data'][..productid..][..productvariant..]
and you post something that arrives as:
$_POST['product_data'][123][987]['prezzo0']
$allKeys = array_keys($_POST['product_data'])
Now $allKeys will contains an array with 123.
If you post multiple productdata, that arrive like this:
$_POST['product_data'][123][123]['prezzo0']
$_POST['product_data'][22][165]['prezzo0']
Then $allKeys will contains an array with 123 AND 22.
Read more here:
http://nl2.php.net/manual/en/function.array-keys.php
Alternatively you can use foreach as here under:
foreach ($_POST['product_data'] as $aProductKey => $productInfo){
// $aProductKey now 123
}
You can do the same productinfo.
Hope that helps, but I would advice you to make better better use of
Javascript, because that is an easier approach. (And stay away from JQuery)
Good luck.
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
|
|
|
Re: Associative Array [message #176164 is a reply to message #176161] |
Mon, 28 November 2011 12:27 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
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
==================
|
|
|
|
Re: Associative Array [message #176166 is a reply to message #176164] |
Mon, 28 November 2011 13:31 |
Jesolo Sun
Messages: 8 Registered: November 2011
Karma: 0
|
Junior Member |
|
|
"Jerry Stuckle" ha scritto nel messaggio news:javunb$78b$1(at)dont-email(dot)me...
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.
Ok i understand
i have used this example
http://us.php.net/manual/en/function.array-keys.php#73992:
the response of Array is this
Array
(
[0] => 0
[1] => product_data
[2] => 99
[3] => 300
[4] => prezzo0
[5] => prezzo1
[6] => prezzo2
[7] => prezzocal0
[8] => prezzocal1
[9] => prezzocal2
[10] => numero0
[11] => numero1
[12] => numero2
[13] => color
[14] => tipo_stampa
[15] => il_colore0
[16] => il_colore1
[17] => il_colore2
[18] => ad_adornment
[19] => 0
[20] => 1
[21] => 2
[22] => 3
[23] => pacchetto_id
[24] => colorepack
[25] => realization_period
[26] => submit
)
question:
Is it to get this values?
example
$val0 = [2] => 99
$val1 = [4] => 1,44
$val1 = [14] => 2_0
|
|
|
Re: Associative Array [message #176167 is a reply to message #176165] |
Mon, 28 November 2011 13:48 |
Jesolo Sun
Messages: 8 Registered: November 2011
Karma: 0
|
Junior Member |
|
|
"Cristiano Larghi" ha scritto nel messaggio
news:javvii$j6v$1(at)dont-email(dot)me...
Il Mon, 28 Nov 2011 07:27:16 -0500, Jerry Stuckle ha scritto:
> <INPUT id="99_300_prezzo0" name="product_data[0][0][0]"
> readOnly="readonly" type="text"> (value for prezzo0)
id (and name) *CANNOT* start with a digit ...
http://www.w3.org/TR/html4/types.html#type-name
Modified.....
Grazie dell'aiuto
Thanks for help me
|
|
|
Re: Associative Array [message #176168 is a reply to message #176164] |
Mon, 28 November 2011 14:59 |
Jesolo Sun
Messages: 8 Registered: November 2011
Karma: 0
|
Junior Member |
|
|
SOLVED
<input type="hidden" name="ProductID" value="<?php echo $riga['ProductID']
?>">
<input type="hidden" name="Capacity" value="<?php echo
$riga['Capacity'] ?>">
$ProductID = $_POST['ProductID'];
$Capacity = $_POST['Capacity'];
print "Quantita 0 "
..$_POST['product_data'][$ProductID][$Capacity]['numero0']."<br>";
print "Quantita 1 "
..$_POST['product_data'][$ProductID][$Capacity]['numero1']."<br>";
print "Quantita 2 "
..$_POST['product_data'][$ProductID][$Capacity]['numero2']."<br>";
$Option1 = $_POST['product_data'][$ProductID][$Capacity]['ad_adornment'];
$Option2 =
$_POST['product_data'][$ProductID][$Capacity]['ad_adornments_options'];
foreach($Option1 as $val_A){
print "Opzione " .$val_A."<br>";
}
foreach($Option2 as $val_B){
print "Opzione " .$val_B."<br>";
}
print "Tempi " .$val1 =
$_POST['product_data'][$ProductID][$Capacity]['realization_period']."<br>";
Thanks to all for help me
|
|
|
Re: Associative Array [message #176169 is a reply to message #176168] |
Mon, 28 November 2011 15:39 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 11/28/2011 3:59 PM, Jesolo Sun wrote:
> SOLVED
>
> <input type="hidden" name="ProductID" value="<?php echo
> $riga['ProductID'] ?>">
> <input type="hidden" name="Capacity" value="<?php echo $riga['Capacity']
> ?>">
>
>
>
> $ProductID = $_POST['ProductID'];
> $Capacity = $_POST['Capacity'];
>
>
>
> print "Quantita 0 "
> .$_POST['product_data'][$ProductID][$Capacity]['numero0']."<br>";
> print "Quantita 1 "
> .$_POST['product_data'][$ProductID][$Capacity]['numero1']."<br>";
> print "Quantita 2 "
> .$_POST['product_data'][$ProductID][$Capacity]['numero2']."<br>";
>
>
>
> $Option1 = $_POST['product_data'][$ProductID][$Capacity]['ad_adornment'];
> $Option2 =
> $_POST['product_data'][$ProductID][$Capacity]['ad_adornments_options'];
>
> foreach($Option1 as $val_A){
> print "Opzione " .$val_A."<br>";
>
> }
>
> foreach($Option2 as $val_B){
> print "Opzione " .$val_B."<br>";
>
> }
>
> print "Tempi " .$val1 =
> $_POST['product_data'][$ProductID][$Capacity]['realization_period']."<br>";
>
> Thanks to all for help me
>
>
Glad it works.
But I am a bit confused now.
When I suggested this solution you said it was impossible because of
some Javascript issue it raised for you.
Is that solved now?
Or was there no issue at all?
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
|
|
|
|
Re: Associative Array [message #176171 is a reply to message #176170] |
Mon, 28 November 2011 20:42 |
Doug Miller
Messages: 171 Registered: August 2011
Karma: 0
|
Senior Member |
|
|
On 11/28/2011 1:57 PM, Jerry Stuckle wrote:
> On 11/28/2011 7:41 AM, Cristiano Larghi wrote:
>> Il Mon, 28 Nov 2011 07:27:16 -0500, Jerry Stuckle ha scritto:
>>
>>> <INPUT id="99_300_prezzo0" name="product_data[0][0][0]"
>>> readOnly="readonly" type="text"> (value for prezzo0)
>>
>> id (and name) *CANNOT* start with a digit ...
>>
>> http://www.w3.org/TR/html4/types.html#type-name
>
> PHP doesn't care...
>
Except to the extent that the HTML error may affect the way the browser
presents the $_POST array to the server. The original post isn't
available to me any more, but IIRC it showed that his $_POST array had
*three* elements where he really wanted only one, e.g.
$_POST ['99']
$_POST ['300']
$_POST ['prezzo0']
where he was expecting to see
$_POST ['99_300_prezzo0']
ISTM that he may not have had this problem had the HTML code read
<INPUT id="A_99_ ... etc.
|
|
|
Re: Associative Array [message #176172 is a reply to message #176171] |
Mon, 28 November 2011 21:00 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 11/28/2011 3:42 PM, Doug Miller wrote:
> On 11/28/2011 1:57 PM, Jerry Stuckle wrote:
>> On 11/28/2011 7:41 AM, Cristiano Larghi wrote:
>>> Il Mon, 28 Nov 2011 07:27:16 -0500, Jerry Stuckle ha scritto:
>>>
>>>> <INPUT id="99_300_prezzo0" name="product_data[0][0][0]"
>>>> readOnly="readonly" type="text"> (value for prezzo0)
>>>
>>> id (and name) *CANNOT* start with a digit ...
>>>
>>> http://www.w3.org/TR/html4/types.html#type-name
>>
>> PHP doesn't care...
>>
> Except to the extent that the HTML error may affect the way the browser
> presents the $_POST array to the server. The original post isn't
> available to me any more, but IIRC it showed that his $_POST array had
> *three* elements where he really wanted only one, e.g.
> $_POST ['99']
> $_POST ['300']
> $_POST ['prezzo0']
> where he was expecting to see
> $_POST ['99_300_prezzo0']
>
> ISTM that he may not have had this problem had the HTML code read
> <INPUT id="A_99_ ... etc.
PHP doesn't care...
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: Associative Array [message #176173 is a reply to message #176172] |
Mon, 28 November 2011 23:26 |
Doug Miller
Messages: 171 Registered: August 2011
Karma: 0
|
Senior Member |
|
|
On 11/28/2011 4:00 PM, Jerry Stuckle wrote:
> On 11/28/2011 3:42 PM, Doug Miller wrote:
>> On 11/28/2011 1:57 PM, Jerry Stuckle wrote:
>>> On 11/28/2011 7:41 AM, Cristiano Larghi wrote:
>>>> Il Mon, 28 Nov 2011 07:27:16 -0500, Jerry Stuckle ha scritto:
>>>>
>>>> > <INPUT id="99_300_prezzo0" name="product_data[0][0][0]"
>>>> > readOnly="readonly" type="text"> (value for prezzo0)
>>>>
>>>> id (and name) *CANNOT* start with a digit ...
>>>>
>>>> http://www.w3.org/TR/html4/types.html#type-name
>>>
>>> PHP doesn't care...
>>>
>> Except to the extent that the HTML error may affect the way the browser
>> presents the $_POST array to the server. The original post isn't
>> available to me any more, but IIRC it showed that his $_POST array had
>> *three* elements where he really wanted only one, e.g.
>> $_POST ['99']
>> $_POST ['300']
>> $_POST ['prezzo0']
>> where he was expecting to see
>> $_POST ['99_300_prezzo0']
>>
>> ISTM that he may not have had this problem had the HTML code read
>> <INPUT id="A_99_ ... etc.
>
> PHP doesn't care...
>
Except to the extent that markup errors [apparently] affect the way the
$_POST array is presented to the script...
|
|
|
Re: Associative Array [message #176174 is a reply to message #176173] |
Tue, 29 November 2011 02:03 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 11/28/2011 6:26 PM, Doug Miller wrote:
> On 11/28/2011 4:00 PM, Jerry Stuckle wrote:
>> On 11/28/2011 3:42 PM, Doug Miller wrote:
>>> On 11/28/2011 1:57 PM, Jerry Stuckle wrote:
>>>> On 11/28/2011 7:41 AM, Cristiano Larghi wrote:
>>>> > Il Mon, 28 Nov 2011 07:27:16 -0500, Jerry Stuckle ha scritto:
>>>> >
>>>> >> <INPUT id="99_300_prezzo0" name="product_data[0][0][0]"
>>>> >> readOnly="readonly" type="text"> (value for prezzo0)
>>>> >
>>>> > id (and name) *CANNOT* start with a digit ...
>>>> >
>>>> > http://www.w3.org/TR/html4/types.html#type-name
>>>>
>>>> PHP doesn't care...
>>>>
>>> Except to the extent that the HTML error may affect the way the browser
>>> presents the $_POST array to the server. The original post isn't
>>> available to me any more, but IIRC it showed that his $_POST array had
>>> *three* elements where he really wanted only one, e.g.
>>> $_POST ['99']
>>> $_POST ['300']
>>> $_POST ['prezzo0']
>>> where he was expecting to see
>>> $_POST ['99_300_prezzo0']
>>>
>>> ISTM that he may not have had this problem had the HTML code read
>>> <INPUT id="A_99_ ... etc.
>>
>> PHP doesn't care...
>>
> Except to the extent that markup errors [apparently] affect the way the
> $_POST array is presented to the script...
Nope. An id starting with a numeric doesn't affect how values are posted.
But again, PHP doesn't care. It uses the information as presented
(which does NOT include the id= field). If the HTML is bad, that's not
a PHP problem.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|