Page 1 of 1

how to pass values from one page to another

Posted: Mon Apr 03, 2006 5:23 am
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

Posted: Mon Apr 03, 2006 6:02 am
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

Posted: Mon Apr 03, 2006 6:19 am
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?

Posted: Mon Apr 03, 2006 6:25 am
by anky666
No, i am not able to transfer to third page.

how can i transfre and then retrieve on third page.

thanks again

Posted: Mon Apr 03, 2006 6:51 am
by Grim...

Code: Select all

<input type="hidden" name="someName" value="<?php echo $_GET['varName']; ?>" />

Posted: Mon Apr 03, 2006 8:31 am
by feyd
use sessions, it's so much safer.

Posted: Mon Apr 03, 2006 9:15 am
by timvw
Use the search function... you're not the first with this problem.