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
Associative Array [message #176142] Sat, 26 November 2011 00:37 Go to previous message
Jesolo Sun is currently offline  Jesolo Sun
Messages: 8
Registered: November 2011
Karma:
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?
[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: Sun Nov 10 12:52:12 GMT 2024

Total time taken to generate the page: 0.05701 seconds