You should have session_start(); on every page that you want to hold the
session.

The way I would do what you are trying to achieve is go the $_SUPERGLOBALS
way..

on the submit_information.php page:

<?php
    session_start();
    $_SESSION['image'] = $_POST['image'];

    foreach($_SESSION['image'] as $foo){
        echo $foo . "<br>\n";
    }
?>

Also, another good way of debugging etc is to use the print_r() function
(http://www.php.net/print_r)

If you do :

<pre><?php print_r($_SESSION);?></pre>

This produces a nice formatted look at the the session arrays/structures -
same goes for all arrays.

Hope that helps,

Craig


"Laurence" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> hello everyone,
>
> I'm trying to get some images value from a checkbox putting them in a
session to preserve the data.  The array works perfectly without the
session_start() and session_register.
>
> can anyone help?
>
> html script
>
> <html>
> <head>
> <title></title>
> </head>
>
> <body>
> <form action="submit_information.php" method="post">
>  <input type="checkbox" name=Image[] value="Image_One">
>  <img src=".gif" name="Image_One"><br>
>  <input type="checkbox" name=Image[] value="Image_Two">
>  <img src=".gif" name="Image_Two"><br>
>  <input type="checkbox" name=Image[] value="Image_Three">
>  <img src=".gif" name="Image_Two"><br>
>  <input type="checkbox" name=Image[] value="Image_four">
>  <img src=".gif" name="Image_One"><br>
>  <input type="checkbox" name=Image[] value="Image_five">
>  <img src=".gif" name="Image_Two"><br>
>  <input type="checkbox" name=Image[] value="Image_six">
>  <img src=".gif" name="Image_Two"><br>
>  <input type="submit" value="submit">
> </form>
> </body>
> </html>
>
> php script: submit_information.php
>
> <?php
> session_start();
> session_register("Image");
>
> $count = count($Image);
> for ($i=0; $i<$count; $i++)
> {
>   echo $Image[$i];
> }
>
> //I also tried that
> /*foreach ($Image as $i=> $Img)
> {
>  $Img == $Image[$i];
>  echo $Img;
> }*/
>
> ?>
>
>
>
>
> ---------------------------------
> With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits
your needs
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to