Page 1 of 1

Reloading the page with updated query string values

Posted: Wed Sep 19, 2007 5:35 pm
by enchance
I'm trying to build a small portfolio and instead of using several HTML pages I wanted to just use PHP. What I have is an array of each image's path (for the "src" attribute). I was thinking when I click "Next" (a text link) it increments the array and once it has reloaded itself it would simply look at the query string then display the new image.

I have some questions though:
1. What line do I use which will reload the page with the new incremented variables?
2. When the page reloads itself, will it automatically get the new image to load? I already placed $thisimage = $_GET['imagenumber'] at the very top so it updates the "src" attribute for the image.

Thanks in advance. Any help/suggestions would be great, especially with that reloading part.

Posted: Wed Sep 19, 2007 5:41 pm
by feyd
1. Echo. Probably with some link tag stuff.
2. Provided you give that information to the page, I don't see why not.

Posted: Wed Sep 19, 2007 7:43 pm
by Josh1billion
Hm.. what if you just had the "Next" button link to the URL with the next id?

If it was an HTML link instead of a Next button, you could just do this (adapt it to be in button format, or an image, if you wish):

Code: Select all

$next_image_number = $_GET['imagenumber'] + 1;
print "<a href='display.php?imagenumber=$next_image_number'>Click here to see the next image</a>";