.a little help guys..
I have an index.php page which contains tags which when clicked opens up picture.php. .my picture.php is a page that retrieves images from a certain database depending on what is the idno.
.what i want to do is to add an "idno" attribute on my anchor tag that when the user clicks a certain tag the index.php sends the idno to my picture.php so that the picture.php knows what image to fetch from the database. help pls!
Figuring out how to set $idno is left as an exercise to the OP.
You can send the parameter to
picture.php
via GETYou could use GET to pass idno to pictures.php
so your link would look like this:
In your picture.php:
Make sure you sterilize $idno before using it in a MySQL query. If idno is a number, then you can also check if it's an integer:
So for your anchor tag, could you do something like this?
Now in your
pictures.php
file, you can read the ID like this:The only thing to watch out for is to make sure you sanitize that input, before you pass it off to a database query so you aren't vulnerable to a SQL injection attack.