how to pass values from one page to another

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
anky666
Forum Newbie
Posts: 9
Joined: Fri Mar 31, 2006 3:00 am

how to pass values from one page to another

Post by anky666 »

hi !
I am developing web pages in PHP.. where I have to send the some variable to one page to another.

do u know, how to write the code?

I passed the ID from first page thrugh the URL like <a href=\"naya4.php?name=" .$row['Name'] . "\">

my second page code looks like this

<form name="input" action="121.php">
Username:
<input type="text" name="user">
<input type="submit" value="Submit">
</form>


nw, I have to transfer varaible from second page to third page.
I heard, I shld use hidden text box, I am not able to write the code..please help to write code for 2nd and 3rd page.

Please help.
thanks
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

Code: Select all

<input type="hidden" name="someName" value="<?php echo $_GET['varName']; ?>" />
should do it.
input type = hidden, don't show anyting on the screen, but if you view->source you can see it.
value = "" same as echoing any value in html
anky666
Forum Newbie
Posts: 9
Joined: Fri Mar 31, 2006 3:00 am

Post by anky666 »

how can i take it into database on third page...
Do u think.. second page will be able to pass the variable from first to second and to third?
anky666
Forum Newbie
Posts: 9
Joined: Fri Mar 31, 2006 3:00 am

Post by anky666 »

No, i am not able to transfer to third page.

how can i transfre and then retrieve on third page.

thanks again
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Code: Select all

<input type="hidden" name="someName" value="<?php echo $_GET['varName']; ?>" />
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

use sessions, it's so much safer.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Use the search function... you're not the first with this problem.
Post Reply