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

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

 



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@xxxxxxxxx] 
Sent: Friday, May 20, 2011 3:28 PM
To: Robert Cummings
Cc: Andre Polykanine; admin@xxxxxxxxxxxxxxxxxxx; tedd;
php-general@xxxxxxxxxxxxx
Subject: Re:  <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


-- 
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