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:

$_POST['test'] = 'hello';

would it transfer that variable to next page.
3) is it possible to post variable with the header command:

header("Location: index.php?Successful=UPDATED&hello=yes");

into something that can post multiple variable while going to the second page.

Recommended Answers

All 2 Replies

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.

2) Lets say i post declare a variable by typing:

$_POST['test'] = 'hello';

would it transfer that variable to next page.

No. All you are doing is assign the value "hello" to a new variable named $_POST. 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

3) is it possible to post variable with the header command:

header("Location: index.php?Successful=UPDATED&hello=yes");

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.

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. ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.