Re: <img src .....> problem in onclick

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11-05-20 03:27 PM, Negin Nickparsa wrote:
i want to click on the image then it stores the session so i can have many
different tables in another one unique page
suppose that i have A in my column when i click on image then it showed me
the table of A in another page
but if i click on the image of B then in the next page  it will show me the
B table
and the solution is by passing session

It sounds to me like you are trying to use the wrong tool for the job. This should probably be handled with a GET variable (via URL parameter):

<a href="target.php?action=table1"><img src="..." alt="description1" /></a>
<a href="target.php?action=table2"><img src="..." alt="description2" /></a>
<a href="target.php?action=table3"><img src="..." alt="description3" /></a>

Then in target.php you have something like the following:
<?php

    $action = isset( $_GET['action'] ) ? $_GET['action'] : null;

    if( $action === 'table1' )
    {
        // Output table 1 HTML code.
    }
    else
    if( $action === 'table2' )
    {
        // Output table 2 HTML code.
    }
    else
    if( $action === 'table3' )
    {
        // Output table 3 HTML code.
    }
    else
    {
        echo 'Whaaaaaat the @*&@&?!';
    }
?>

Heck, you can even use this to set the SESSION variable if you want it for later:

<?php

    $action = isset( $_GET['action'] ) ? $_GET['action'] : null;

    $_SESSION['tableType'] = $action;

    if( $action === 'table1' )
    {
        // Output table 1 HTML code.
    }
    else
    if( $action === 'table2' )
    {
        // Output table 2 HTML code.
    }
    else
    if( $action === 'table3' )
    {
        // Output table 3 HTML code.
    }
    else
    {
        echo 'Whaaaaaat the @*&@&?!';
    }
?>

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux