Reloading the page with updated query string values

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
enchance
Forum Commoner
Posts: 34
Joined: Sat Sep 15, 2007 12:10 pm

Reloading the page with updated query string values

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
Josh1billion
Forum Contributor
Posts: 316
Joined: Tue Sep 11, 2007 3:25 pm

Post 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>";
Post Reply