POST with header

Thread Solved

Join Date: Jun 2005
Posts: 147
Reputation: ashneet is an unknown quantity at this point 
Solved Threads: 1
ashneet's Avatar
ashneet ashneet is offline Offline
Junior Poster

POST with header

 
0
  #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 7:51 pm.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: POST with header

 
0
  #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 Quick reply to this message  
Join Date: Jun 2005
Posts: 147
Reputation: ashneet is an unknown quantity at this point 
Solved Threads: 1
ashneet's Avatar
ashneet ashneet is offline Offline
Junior Poster

Re: POST with header

 
0
  #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 Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 8453 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC