Re: <img src .....> problem in onclick
| From: | Andre Polykanine | Date: | Fri, 20 May 2011 15:41:17 +0000 |
| Subject: | Re: <img src .....> problem in onclick | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312977@lists.php.net to get a copy of this message | ||
Hello Negin,
that is completely wrong. You're mixing up two things: PHP is a
server-side language, JavaScript is a client-side language.
onClick is client-side, so you can't say onClick="<?php
something();"?>" because onclick is performed *after* the PHP script
something();"?>is *completely* formed and sent to the user's browser.
What you can do is changing your PHP variables by using AJAX. Consider
reading about jQuery in general and $.ajax in particular.
--
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion
------------ Original message ------------
From: Negin Nickparsa <nickparsa@gmail.com>
To: php-general@lists.php.net
Date created: , 4:05:34 PM
Subject: [PHP] <img src .....> problem in onclick
i want to when clicking on the image then go to other page or set my
$_SESSION
i have this in php code:
echo"<img src=' ' onclick='$_SESSION['s1']=12(i mean a
number)';/>";
how can i correct this
or if it is completely wrong how 2 solve it?
i tried to set header in onclick too but i think it can't do because header
is function of php and i echoed the html tag