check if link is clicked in php

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
seaten
Forum Newbie
Posts: 22
Joined: Thu Mar 16, 2006 1:30 pm

check if link is clicked in php

Post by seaten »

Im a newbie.

Is it possible in PHP to check if a link was clicked?

I know with for example checkboxes this is possible . e.g.


Code: Select all

if (!$_POST['sel_product_category'] ) {
 $arrErrors['sel_product_category'] = 'Please provide a category name for your Product.';
}

<label for="sel_product_category">Product Category:</label>
 <input name="sel_product_category" type="Text" id="sel_product_category" value="">
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Not sure what you mean. If the link points to another part of your website then it's pretty easy by just setting s session variable on the new page.

If the link points to an external website then you just need to go via an intermediate page on your own site first (you'll have seen this done on other sites):

So you'd point your link to something like:

http://www.yoursite.com/redirect.php?si ... google.com

On redirect.php you just check the value of $_GET['site'] and ;)
Post Reply