Passint variables through POST

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ptysell
Forum Commoner
Posts: 34
Joined: Tue Dec 02, 2003 9:27 pm
Location: USC

Passint variables through POST

Post by ptysell »

i was wondering if it is possible to pass a variable through POST. I need to pass an array to another document through post. I know that it is not possible to call PHP function through a button. I just want to cut down on the number of queries that i perform.

What i am trying to do is to creat a function that takes the page content and opens it in a new window w/o page nav so that it prints nice.

I could pass the artical ID to the other page, but that would require another MYSQL query. I can pass the text of the document through POST.

I am not sure what is better.

Thanks.

Hope that makes since but it is late and i am too lazy to re read it.
amarquis
Forum Newbie
Posts: 10
Joined: Fri Dec 19, 2003 3:53 pm
Location: Switzerland

Post by amarquis »

Not sure to get what you need but you could try the following as this is the method I use to pass variables from a page to another :

On your page1.php :

Code: Select all

<FORM ACTION="page2.php" METHOD="post" ENCTYPE="x-www-form-urlencoded">
<input type="text" name="FIELD1">
<input type="submit" name="SUBMIT" value="Next">
</FORM>
On page2.php :

Code: Select all

<?php
echo "$FIELD1";
?>
Hope this helps...
dsoftnet
Forum Newbie
Posts: 3
Joined: Thu Dec 25, 2003 6:27 am
Contact:

Post by dsoftnet »

I want to know where is your contant stored that you want to pass out.

is that in DB or just static text?
User avatar
gite_ashish
Forum Contributor
Posts: 118
Joined: Sat Aug 31, 2002 11:38 am
Location: India

Post by gite_ashish »

u can keep the db field(s) contents in some hidden variable(s) in the main window and open the new window (w/o nav), and access the hidden vars in JavaScript like:
window.opener. formName.varName.value

in this case, no post required, and u r saving the query also.
ptysell
Forum Commoner
Posts: 34
Joined: Tue Dec 02, 2003 9:27 pm
Location: USC

Post by ptysell »

i got it under controll but thanks.
I am just passing each variable that i need through post and then just outputting it in a new window via the target = _blank.

Thanks.
Post Reply