User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,551 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,566 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 2572 | Replies: 2 | Solved
Reply
Join Date: Jun 2005
Location: USA
Posts: 147
Reputation: ashneet is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
ashneet's Avatar
ashneet ashneet is offline Offline
Junior Poster

Question POST with header

  #1  
Jul 11th, 2006
I have three question:
1) how can i post a variable which is an array?
2) Lets say i post declare a variable by typing:
[php]$_POST['test'] = 'hello';[/php]
would it transfer that variable to next page.
3) is it possible to post variable with the header command:
[php]header("Location: index.php?Successful=UPDATED&hello=yes");[/php]

into something that can post multiple variable while going to the second page.
Last edited by ashneet : Jul 11th, 2006 at 6:51 pm.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 34
Moderator
Staff Writer
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: POST with header

  #2  
Jul 11th, 2006
Originally Posted by ashneet
I have three question:
1) how can i post a variable which is an array?
You can't as an array. But I don't think you're using the word "post" properly so you might want to explain yourself better.

Originally Posted by ashneet
2) Lets say i post declare a variable by typing:
[php]$_POST['test'] = 'hello';[/php]
would it transfer that variable to next page.
No. All you are doing is assign the value "hello" to a new variable named $_POST['test']. If youwant it to carry over to a new page you need to:

1) attach it to a query string that is in the url of the new page (i.e. GET)
2) POST it to the new page (like a form)
3) Use cookies to retain the value
4) Use a session to retain the value

Originally Posted by ashneet
3) is it possible to post variable with the header command:
[php]header("Location: index.php?Successful=UPDATED&hello=yes");[/php]

into something that can post multiple variable while going to the second page.
Again, I don't think you're using the word POST correctly again. Adding the variable on to a query string is a good way to get a variable to a new page as you have in your example. But this is not "post"ing the variable. That method is called the GET method.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote  
Join Date: Jun 2005
Location: USA
Posts: 147
Reputation: ashneet is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
ashneet's Avatar
ashneet ashneet is offline Offline
Junior Poster

Re: POST with header

  #3  
Jul 11th, 2006
Thanks for the help,
I guss I will have to use session instead.
All i wanted to do was to keep variable alive for two pages the easiest way without using session but in the end sessions can do everything.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 9:19 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC