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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.