473,387 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Passing a $_POST reference to another page

epots9
1,351 Expert 1GB
would it be possible to pass the contains of a $_POST reference to another page without submitting the form?

I have a page which using $_POST to fill up some of the fields, and i have a print button that re-open the same exact page in a new window (javascript), without all the buttons, icons, etc. for a printer-friendly page, but since i'm not submitting the page the $_POST references are lost...how can i get around this?

**i'm trying to aviod merging everything into a single string and storing it as an session.

thanks in advance
Jun 26 '07 #1
4 2035
pbmods
5,821 Expert 4TB
Heya epots9.

If you use $_REQUEST instead of $_POST, you could pass the values in the URL.

Alternatively, you could use CSS to make the printed copy pretty (specify media="print" in the LINK tag, or use a
Expand|Select|Wrap|Line Numbers
  1. @media print {
  2.     body {
  3.         color: #000000;
  4.     }
  5.  
  6.     /* etc. */
  7. }
rule in your stylesheet).

Without making an AJAX call or submitting a form, though, you can't POST from the browser.
Jun 26 '07 #2
mwasif
802 Expert 512MB
Save all the POSTed data in session like
[PHP]$_SESSION = $_POST;[/PHP]

May be someone else can give you a better solution.

[The problem in this approach, it may overwrite some session data incase of same index values]
Jun 26 '07 #3
epots9
1,351 Expert 1GB
thanks for the replies, i think due to state i'm in and where i am, sessions will have to be the answer
Jun 26 '07 #4
pbmods
5,821 Expert 4TB
[PHP]$_SESSION = $_POST;[/PHP]

[The problem in this approach, it may overwrite some session data incase of same index values]
Use
Expand|Select|Wrap|Line Numbers
  1. array_merge($_SESSION, $_POST);
, or
Expand|Select|Wrap|Line Numbers
  1. $_SESSION += array_diff_key($_POST, $_SESSION);
.
Jun 26 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
6
by: Robert Rozman | last post by:
Hi, I'm total php newbie and probably have trivial problem. I have following two scripts. First creates web form and should run second script with two arguments. But those two arguments don't...
10
by: Dave Smithz | last post by:
Hi there, I have a situation where I want to have multiple submit buttons on the same form and therefore want to use a redirection php script that checks the value associated with the submit...
10
by: Joseph S. | last post by:
Hi, How do I pass a string from one call to a php block to another call in the same page but from another form? Here's my full php code: I'm using two forms in the same page. A hidden field...
6
by: JackM | last post by:
I have a multiple select input in a form that's being populated by a row from my database as such: <input type=\"checkbox\" name=\"subm\" value=\"$row\"> That part is working fine as I can check...
22
by: K. A. | last post by:
I have two servers at work, 'A' for testing and development, and server 'B' for production. On server A, I wrote a PHP test code to login users then direct them to a personalized page. This is...
3
by: shara | last post by:
Hello there, I want to pass multiple values selected in a select box(HTML) to another php page.I tried doing in several ways but of no use.Can anybody please help me with this. The code i used...
7
by: amygdala | last post by:
Hi all, I'm starting this new project in which I'ld like to implement sort of a design pattern I have seen being used in the CodeIgniter framework. Basically, the site will examine the URI and...
5
by: aelred | last post by:
I have a web page where a member can open up a chat window (child window) with another member. - From there the member can also navigate to other web pages. - From other pages in the site, they...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.