New window, not a new window...

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
kayec
Forum Newbie
Posts: 5
Joined: Tue Jul 09, 2002 7:49 pm

New window, not a new window...

Post by kayec »

I've got a large PHP page that is filled with options for producing a report. The user can select options which effect other options.

What i want to do is this. If the user is just changing options, the page just SUBMITS back to itself to update the options, however, if they pick "Produce Report" i want the page to open a new window.

This way when they're done they can close the window and return to the parent window with all their selected options still set.

Is this a Javascript thing or can it be done though PHP?

Thanks!!!!!

PS Because of the large number of options, i have to use METHOD=POST so using the back button isn't very eligant. :(
w3cynic
Forum Newbie
Posts: 12
Joined: Sun Aug 11, 2002 11:06 am

It's .js

Post by w3cynic »

I would either store the input for the last $x number of visitors in the db and pass a unique id, or use sessions.

You could use plain old cookies, have you considered making an md5 of all possible selection combinations and storing the hash in a cookie? Then you just compare the hash to a pre-defined list of options on subsequent page loads to save state.

If you want to go with a new window - set a conditional to require/include the javascript and pop-up the window when $submitted="true".
kayec
Forum Newbie
Posts: 5
Joined: Tue Jul 09, 2002 7:49 pm

Post by kayec »

Yea, i'm using sessions, but it's just to much crap to store. Opening a new windows would be easier. Thanks though.

To see if they were chaning options i was looking for a varable assoicated with the "Produce Report" button. Since the button is not long a "button" that submits the page, i can't use that. So in the end i'm using:



&nbsp; <input type=hidden name=producereport_x>

&nbsp; <a href="#" onClick="newReportWindow();"><img src='/images/button-report.gif' onMouseOver=this.src='/images/button-report-over.gif'; onMouseOut=this.src='/images/button-report.gif'; border=0></a>

######

function newReportWindow() {
document.input.producereport_x.value = "1";
document.input.target = "_new";
document.input.submit();
}

Guess it was a Javascript thing, sorry. 8)
Post Reply