944,208 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 14832
  • PHP RSS
Jul 11th, 2006
0

POST with header

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster
ashneet is offline Offline
147 posts
since Jun 2005
Jul 11th, 2006
0

Re: POST with header

Quote 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.

Quote 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

Quote 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.
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006
Jul 11th, 2006
0

Re: POST with header

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.
Reputation Points: 10
Solved Threads: 1
Junior Poster
ashneet is offline Offline
147 posts
since Jun 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: How to make phpBB more interactive?
Next Thread in PHP Forum Timeline: I want to let members message each other





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC