ONLCLICK hyperlink : how to??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
azhan
Forum Commoner
Posts: 68
Joined: Fri Jun 27, 2008 6:05 am

ONLCLICK hyperlink : how to??

Post 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
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: ONLCLICK hyperlink : how to??

Post by jaoudestudios »

why do you have a <p> tag in the middle of <a> tag?
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: ONLCLICK hyperlink : how to??

Post by ghurtado »

Also, make sure you understand the difference between PHP (server side) and Javascript (clientside, onclick)
Post Reply