Help needed - URL parameters do not update variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe Lui

    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.p hp?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
  • ScareCrowe

    #2
    Re: Help needed - URL parameters do not update variables

    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($star t)){
    $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" <joe_lui@hotmai l.com> wrote in message
    news:661d2158.0 408030941.18ffa 45c@posting.goo gle.com...[color=blue]
    > 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.p hp?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[/color]




    -----= 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! =-----

    Comment

    • Tim Tyler

      #3
      Re: Help needed - URL parameters do not update variables

      Joe Lui <joe_lui@hotmai l.com> wrote or quoted:
      [color=blue]
      > 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.p hp?start=16">. However, $start is not updated after
      > the link is clicked. What did I miss?[/color]

      The line:

      $start = $_GET['start'];

      ....by the sound of it.
      --
      __________
      |im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.

      Comment

      Working...