Jump to content

[SOLVED] echo Array


phpretard

Recommended Posts

This just echos "Array".  WHY?

 


if(isset($_POST['order_photo'])) { 

$picture = array();

$picture[0] = $_POST['S46'];
$picture[1] = $_POST['QU46'];
$picture[2] = $_POST['S57'];
$picture[3] = $_POST['QU57'];
$picture[4] = $_POST['S810'];
$picture[5] = $_POST['QU810'];

echo $picture;

}

 

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/101689-solved-echo-array/
Share on other sites

Try this

 

<?php

if(isset($_POST['order_photo'])) { 

$picture = array();

$picture[0] = $_POST['S46'];
$picture[1] = $_POST['QU46'];
$picture[2] = $_POST['S57'];
$picture[3] = $_POST['QU57'];
$picture[4] = $_POST['S810'];
$picture[5] = $_POST['QU810'];

foreach ($picture as $key => $value) {
    echo "<img src='$value' alt='' /><br />";
}

}

?>

 

--

DJ

 

Link to comment
https://forums.phpfreaks.com/topic/101689-solved-echo-array/#findComment-520246
Share on other sites

Because $picture is an array. Try it this way:

 

<?php

if(isset($_POST['order_photo'])) { 

$picture = array();

$picture[0] = $_POST['S46'];
$picture[1] = $_POST['QU46'];
$picture[2] = $_POST['S57'];
$picture[3] = $_POST['QU57'];
$picture[4] = $_POST['S810'];
$picture[5] = $_POST['QU810'];

echo "<pre>";
print_r($picture);
echo "</pre>";

}

?>

 

 

Orio.

Link to comment
https://forums.phpfreaks.com/topic/101689-solved-echo-array/#findComment-520247
Share on other sites

That worked well!

 

Is there an easy way to put the array into a session var?

 

if(isset($_POST['order_photo'])) { 


$picture = array();

$picture[0] = $_POST['S46'];
$picture[1] = $_POST['QU46'];
$picture[2] = $_POST['S57'];
$picture[3] = $_POST['QU57'];
$picture[4] = $_POST['S810'];
$picture[5] = $_POST['QU810'];

echo "<pre>";
print_r($picture);
echo "</pre>";

}

Link to comment
https://forums.phpfreaks.com/topic/101689-solved-echo-array/#findComment-520254
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.