Page 1 of 1

ONLCLICK hyperlink : how to??

Posted: Mon Jul 28, 2008 10:10 am
by azhan
hey guys,

How to insert a function into a hyperlink ?. Such as, i want to insert
a "setcookie" function in the hyperlink code like below

<a href="newpage.php?name=<?php echo urlencode($hello);?>">
<?php
$hour = time() + 3600;
echo '<p>' .$list['name']. '</p>';
setcookie(getname, list['name'], $hour);
?></a>

so that i could recall the cookie in the newpage.php once the user click the hyperlink, but i dont know to put ONCLICK function in the middle of the hyperlink code....please help me...

thanks guys!

Azhan

Re: ONLCLICK hyperlink : how to??

Posted: Mon Jul 28, 2008 10:42 am
by jaoudestudios
why do you have a <p> tag in the middle of <a> tag?

Re: ONLCLICK hyperlink : how to??

Posted: Mon Jul 28, 2008 12:34 pm
by ghurtado
Also, make sure you understand the difference between PHP (server side) and Javascript (clientside, onclick)