RE: [PHP] <img src .....> problem in onclick

From: Date: Fri, 20 May 2011 19:23:50 +0000
Subject: RE: [PHP] <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-313006@lists.php.net to get a copy of this message
Here is an example of how you can set a session variable for PHP with Javascript. The index.php file will Ajax the loadsession.php file and alert the Session variable that has been set. Index.php <?php session_start(); ?> <script type="text/javascript" src="http://www.yourserver.com/js/jquery.js"></script> <SCRIPT TYPE="text/javascript"> $(document).ready( function () { $('#test').click( function () { var frog = $(this).val(); var datalist='link='+frog; $.ajax({ type: "POST", url: 'http://www. yourserver.com/loadsession.php', data: datalist, success: function(returnData){ alert(returnData); } , error:function(returnData){ alert('error to correct'); } }); } ); }); </script> <a ID=test herf=# value=1>Session 1</option> // End index.php // In the loader you can store the fact that a particular link or image was clicked. loadsession.php <?php $_SESSION['lipert'] = "1234"; echo $_SESSION['lipert']; ?> Richard L. Buskirk -----Original Message----- From: Negin Nickparsa [mailto:nickparsa@gmail.com] Sent: Friday, May 20, 2011 3:28 PM To: Robert Cummings Cc: Andre Polykanine; admin@buskirkgraphics.com; tedd; php-general@lists.php.net Subject: Re: [PHP] <img src .....> problem in onclick 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

« previous php.general (#313006) next »