Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Pass value

Links for php scripts

Moderators: macek, egami, gesf

Pass value

Postby kiwi » Tue Aug 31, 2004 12:18 pm

i can pass a variable ( a primary key to update a record) from page A to page B, but i can't pass form page B to page C, can some one help me,? thanks
kiwi
New php-forum User
New php-forum User
 
Posts: 124
Joined: Sun Feb 29, 2004 6:26 am

Postby bezmond » Tue Aug 31, 2004 12:41 pm

how are you passing it from A to B?
User avatar
bezmond
Moderator
Moderator
 
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK

Postby kiwi » Tue Aug 31, 2004 4:39 pm

using the form action and a submit button
kiwi
New php-forum User
New php-forum User
 
Posts: 124
Joined: Sun Feb 29, 2004 6:26 am

Postby gesf » Wed Sep 01, 2004 4:07 am

Passing vars to more than 1 page == Using sessions :D
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby Alex » Wed Sep 01, 2004 7:07 am

there are a number of ways to do it, two that are probably the most popular are SESSIONS and if you dont really want to do sessions you can do it using hidden inputs in your form, or you could also use Global Variables
Alex
New php-forum User
New php-forum User
 
Posts: 180
Joined: Fri Mar 07, 2003 4:59 pm

Postby bezmond » Tue Sep 07, 2004 3:15 am

The other possibility, if there is only one variable from page A - as you said, a primary key, you could use the following in the <form> tag for submitting to page B...

<FORM NAME="form1" METHOD="post" ACTION="pagec.php?key=<? echo $_POST["key"]; ?>"> (this assumes that the 'key' is submitted by a form which uses the post method.

Then, on page C, you can use the $_GET method to get the value of this key, which was passed in the URL.


Or as Alex put, you could use a hidden field, and retrieve it in page C using $_POST["field"]


Hope that helps slightly...

Andrew
User avatar
bezmond
Moderator
Moderator
 
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK

Postby Alex » Thu Sep 09, 2004 6:53 pm

The only drawback to using GET is that if you have data that is supposed to be hidden, it wont be since its passed with the url, but there is always encryption...

P.S. Hey bezmod, I like the picture that you use, its awesome!!! Where did you get it?
Alex
New php-forum User
New php-forum User
 
Posts: 180
Joined: Fri Mar 07, 2003 4:59 pm

Postby swirlee » Thu Sep 09, 2004 7:15 pm

Alex wrote:The only drawback to using GET is that if you have data that is supposed to be hidden, it wont be since its passed with the url, but there is always encryption...


Well, POST data isn't exactly hidden.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Postby bezmond » Fri Sep 10, 2004 10:28 am

I was sent it on msn originally
User avatar
bezmond
Moderator
Moderator
 
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK


Return to PHP Scripts

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron