View Single Post
  #1 (permalink)  
Old January 20th, 2005, 02:19 AM
manunair manunair is offline
Registered User
Join Date: Jan 2005
Location: Bangalore, Karnataka, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing variables from HTML to php

Hi, I'm new to PHP and to this forum.
I'd like to clear one doubt.

I've two php pages (page1.php, page2.php). In page1.php i'am trying to access a database and create an html table for the output with each row having an href anchor tag. now on clicking the link page2.php should be loaded with a value passed from page1.php. sample of how i've coded is as follows:

database accessing...

while (-condition-)
    print(<a href='page2.php?sid=$curr_row[0]'>Go to Page 2</a>");

Now the html generated is as follows:
     <a href='page2.php?sid=14'>Go to Page 2</a>
     <a href='page2.php?sid=15'>Go to Page 2</a>
     <a href='page2.php?sid=16'>Go to Page 2</a>

On running, this loads page2.php but i'm not able to receive the value of sid in page2.php I'm not using any form or submit button. Is there any way to get the value of sid directly from href link?
i tried with $_GET['sid'] and $_POST['sid'], but both didn't work.

Any help is most valuable.
thanks and regards

Reply With Quote