...

View Full Version : how do I reload the parent page



kred
05-05-2004, 05:22 AM
hi all,

I have a form, that links to a product pop up window, the pop up has product choices, when they select the product they want and then submit it, how do I get the original page(the parent) page to reload with the new product selection? I'm using $_SESSION['product'] to capture the value. but can't get it to update the info on the form page.

I know it's shouldn't be this difficult, but it my first real go at PHP, any help would apperciated, here is my code I'm using:


form page:

session_start();
if ($_SESSION['select']= $_GET['product']); //get product from pop up if nothing put A
else
$_SESSION['select']="A";


pop up page:

<?php
session_start();
if ($_SESSION['select'] = !isset($_POST['product'])? NULL : $_POST['product']); //store selected product on submit if nothing put A
else
$_SESSION['select']= "A";
?>


selector:

<SELECT NAME= "product">
<OPTION VALUE="<? echo $_SESSION['select']; ?>" SELECTED><? echo $_SESSION['select']; ?>

<OPTION VALUE=B>B
<OPTION VALUE=C>C </option></select>


How do I get the info back into the form, what I'm I missing

any help would be great
K

raf
05-05-2004, 03:58 PM
Not sure about your setup. What happens with the popup after they select a new product ?

It's not a pure PHP issue because you'll allways need javascript to reload the main window. This also means that you need to do the reload from inside the selection-window. I don't think you can do it without javascript.

Do you need to do this in two windows? Can't you keep it inside one window so you don't need to rely on javascript?

I've recently use something similar where i opened a second window where the client can enter a message. If set it upo so that when this message is submitted, the second windows refreshes the main window (to add an icon for the enterd message, at the relevant record), prints a confirmationmessage and then closes itself. Precisely because i couldn't find a way to reload the main window without doing it from the second window (--> best open the second window with javascript so that you don't get a dialog when you close it with javascript)

To proces the selection, well that's the easy part : you just set the sessionvariable and always read that inside your formbuilding page. Initialy, the sessionvar will be empty so nothing is selected. After the selection in the popup, you set the sessionvar to the selected item and reload the main page.

kred
05-05-2004, 06:08 PM
is $_SESSION['product'] the same as a sessionvar and isn't it begin stored on the submit, because the action on the pop up window calls to reload the page, but the value selected isn't being store or rediplayed,


I check for the javascript in the other forums,

thanks for any help
---it's all so new still---

raf
05-05-2004, 09:04 PM
is $_SESSION['product'] the same as a sessionvar and isn't it begin stored on the submit, because the action on the pop up window calls to reload the page, but the value selected isn't being store or rediplayed
It is a sessionvar, yes.
But i didn't understand the rest of your question. Do you wan't to know how to pass it to the main page ?

kred
05-05-2004, 10:05 PM
may main problem right now is that the pop up page doesn't seem to store the submit value, which I thought was/or should be $_SESSION['product'] after the submit button is clicked? because when the pop up reloads it doesn't display,

I'm I using the $_SESSION[] incorrectly??

raf
05-05-2004, 10:48 PM
Your formprocessing code should be like


<?php
session_start();
$_SESSION['select']= "A";
if (isset($_POST['product'])){
$_SESSION['select'] = $_POST['product'];
}
?>

Why are you using the querystring there (the $_GET) ?

sad69
05-05-2004, 10:59 PM
I don't know much about sessions, but I wonder if you're talking about something along the lines of this: on this forum, when you're posting a message, and you put an attachment, you click the manage attachments button.

This pops up a new window where you can upload attachments. Then on the original page that opened the popup, those filenames are there.

I think that's all done using Javascript and DOM through the parent and all that.

I apologize if I'm on a different page here, but if not, maybe you can use that to help model what you're trying to do.

Good luck,
Sadiq.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum