470,848 Members | 1,817 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,848 developers. It's quick & easy.

Help needed - URL parameters do not update variables

Hello everyone,

I am new to PHP and web server in general so please bear with me if
it's an obvious mistake.

My problem is that parameters entered in URL do not update php
variables. I am using IIS on winxp pro with the latest php installed.
PHP seems working fine, i.e. <?php echo '<p>Hello World</p>'; ?>
works as expected.
I am building an automated photo gallery that displays 15 thumbnails
on a page. The starting thumbnail is controlled by a variable called
$start, with initial value = 1. To see the next 15 thumbnails, $start
will be updated to 16. The link look like this: <a
href="gallery.php?start=16">. However, $start is not updated after
the link is clicked. What did I miss?
Is it a php programming problem? Or do I need to configure (if
necessary) my web server? can anyone provide a simple example to
demonstrate how URL parameters work? Please help. Thank you.

Joe
Jul 17 '05 #1
2 1826
Do you have something like this on your page?
$start = 1;

If yes, did you put it in an IF statement like this?
if(!isset($start)){
$start=1;
}else{
$start=$start;//this line not necessary to work, just here for mental
visualization
}

try putting (echo 'start = '.$start;) at the very beginning of the script
on gallery.php. When you click the links, is $start reflecting the value you
want?

You need to give more info for us to help you much more than this. A snippet
of your code or something.
Starting out, I made the mistake of declaring a variable in my script
without the IF ISSET statement, thereby overwriting the variable every time.
Putting the IF ISSET statement in there will see if $start is set and if it
is, it will leave it alone! If it's not set, the server will assume the user
has just arrived at the page, and set the $start value to 1.

Let us know!

--ScareCrowe

"Joe Lui" <jo*****@hotmail.com> wrote in message
news:66**************************@posting.google.c om...
Hello everyone,

I am new to PHP and web server in general so please bear with me if
it's an obvious mistake.

My problem is that parameters entered in URL do not update php
variables. I am using IIS on winxp pro with the latest php installed.
PHP seems working fine, i.e. <?php echo '<p>Hello World</p>'; ?>
works as expected.
I am building an automated photo gallery that displays 15 thumbnails
on a page. The starting thumbnail is controlled by a variable called
$start, with initial value = 1. To see the next 15 thumbnails, $start
will be updated to 16. The link look like this: <a
href="gallery.php?start=16">. However, $start is not updated after
the link is clicked. What did I miss?
Is it a php programming problem? Or do I need to configure (if
necessary) my web server? can anyone provide a simple example to
demonstrate how URL parameters work? Please help. Thank you.

Joe



-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #2
Joe Lui <jo*****@hotmail.com> wrote or quoted:
I am new to PHP and web server in general so please bear with me if
it's an obvious mistake.

My problem is that parameters entered in URL do not update php
variables. I am using IIS on winxp pro with the latest php installed.
PHP seems working fine, i.e. <?php echo '<p>Hello World</p>'; ?>
works as expected.

I am building an automated photo gallery that displays 15 thumbnails
on a page. The starting thumbnail is controlled by a variable called
$start, with initial value = 1. To see the next 15 thumbnails, $start
will be updated to 16. The link look like this: <a
href="gallery.php?start=16">. However, $start is not updated after
the link is clicked. What did I miss?


The line:

$start = $_GET['start'];

....by the sound of it.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

28 posts views Thread by stu_gots | last post: by
13 posts views Thread by EggsAckley | last post: by
9 posts views Thread by Dom Boyce | last post: by
6 posts views Thread by Takeadoe | last post: by
15 posts views Thread by Jay | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.