Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how do I reload the parent page

    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

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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---

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by kred
    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 ?
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #5
    New Coder
    Join Date
    Apr 2004
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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??

  • #6
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Your formprocessing code should be like
    PHP Code:
    <?php
    session_start
    ();
    $_SESSION['select']= "A"
    if (isset(
    $_POST['product'])){
        
    $_SESSION['select'] = $_POST['product'];
    }
    ?>
    Why are you using the querystring there (the $_GET) ?
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #7
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •