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

From: Date: Fri, 20 May 2011 20:10:41 +0000
Subject: Re: <img src .....> problem in onclick
References: 1 2 3 4 5 6 7 8 9  Groups: php.general 
Request: Send a blank email to php-general+get-313012@lists.php.net to get a copy of this message
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.

« previous php.general (#313012) next »