Sending GET info to php through normal links

Associate
Joined
19 Jun 2006
Posts
162
Location
Swansea, Wales
Hi guys,

I know that to send, for example a form, to a php page that writes that info to a database using a submit button.

I was wondering how you would send similar information in a page using a normal <a href="xxx">link</a> link.

For example I have an index page with two links

<a href="shape.php">circle</a>
<a href="shape.php">square</a>

I want to send either "circle" or "square" to shape.php and then display the right shape.

Ideas?

Thanks
 
Code:
<a href="shape.php?shape=circle">circle</a>
<a href="shape.php?shape=square">square</a>
shape.php
Code:
$shape = stripslashes(htmlentities($_GET['shape']));

if ($shape)
{
echo "<img src=\"images/".$shape.".jpg\" />;
}
else
{
echo "no shape selected";
}
might work
 
Last edited:
That should work, but make sure you check $_GET['shape'] for nasty little things.
 
Back
Top Bottom