PHP Checking is a link is pressed?

Stjerne

New member
Hi, everyone. I'm writing some very simple code. I'm simply testing and practicing PHP.

I want to write on the page, "Click here to make a link."

I just want the Click here to be a link, that's not the problem. The problem is checking to see if that link has been pressed. I've set the link's ahref="" to the $_SERVER['PHP_SELF'] so that when a person clicks it the page just refreshes itself but checks if the link has been pressed, and if it's been pressed to make a cookie. This is my code:

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<style type="text/css">
body, html {
text-align: center;
display: inline;
}

.para {
text-align: center;
}
</style>

<?php

?>

<title>Cookie Testing - Home</title>
<meta name="description" content="Academy" />
<meta name="keywords" content="Academy" />
</head>

<body>

<p class="para">
<a href="<?php $_SERVER['PHP_SELF']; ?>">Click here</a> to make a cookie.
</p>

</body>

</html>
 
Back
Top