Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
  1. #1
    Member Arkantos's Avatar
    Join Date
    Jul 2005
    Posts
    66
    Member #
    10732
    hello,

    i am learning to program in PHP. noob :classic:
    i know basic to a small extent.
    my Javascript knowledge is severely limited.

    this is my problem.

    there is a form on base.php
    the form processor is sitting on processor.php
    data is being transferred through POST.

    when the form is filled and the submit button is hit, normally the browser points to processor.php.

    now what i want:
    the form is filled, and the submit button is hit.
    processor.php is opened in a popup window BEHIND the base.php with the post data.
    and base.php is refreshed.

    this is an optional thing but i am trying to do it, some hint would be helpful...
    when base.php is refreshed and the form is submitted again, it should not reuse the aleady open popup, rather it should open ANOTHER popup behind base.php

    help would be highly appreciated,
    Thank you in advance.

    Arkantos.
    No bastard ever won a war by dying for his country, he won it by making the other poor dumb bastard dying for his country.
    General George S. Patton (US Army)

  2.  

  3. #2
    Senior Member Eddy Bones's Avatar
    Join Date
    Jan 2004
    Location
    Washington, USA
    Posts
    1,054
    Member #
    4651
    Forget popups and all that. Forget messing with which window is open when and where. When they hit submit, just have it go to processor.php in a normal window, and then have it link back to base.php when it's done processing. Nobody likes popups and I block them anyway.

    Besides, there's no simple way of refreshing base.php from processor.php other than what I stated above. Keep it simple man.

    Question: what's the use of having all the old popups still open anyway? Maybe I'm missing something here.

  4. #3
    Member Arkantos's Avatar
    Join Date
    Jul 2005
    Posts
    66
    Member #
    10732
    hi eddy,
    nope, that wont do.
    btw, this is not for outside users. more details below.

    answer: this is something of a challenge posed by my dad. he's a doctor in hypothetical mathematics. from what i could understand from the greek, he told him when i asked him, this whole thing has to do with iterations, whatever that means

    refreshing the page with change some (okay, lots) values in hidden fields and the popup wil carry out the maths. dont even go there, i spent 5, F.I.V.E. days to get the equations straight.

    i got 500 rupees (~USD10) riding on this.
    do help me out.

    Arkantos.
    No bastard ever won a war by dying for his country, he won it by making the other poor dumb bastard dying for his country.
    General George S. Patton (US Army)

  5. #4
    Member Arkantos's Avatar
    Join Date
    Jul 2005
    Posts
    66
    Member #
    10732
    <bump>
    No bastard ever won a war by dying for his country, he won it by making the other poor dumb bastard dying for his country.
    General George S. Patton (US Army)

  6. #5
    Senior Member Arkette's Avatar
    Join Date
    Jan 2006
    Location
    Europe
    Posts
    102
    Member #
    12297
    This sounds more like an intellectual exercise rather than a serious website, but that's ok I suppose. Anyway the problem you have is that of communication in a stateless environment. Each window opened on a client machine is independant and stateless that is to say they are not related in any way unless one window is spawned by the other using clientside script in which case they have a parent child relationship within the DOM which again can only be accessed though clientside script. The only way for the child window to cause the parent window to perform a call back to the server to refresh it's content is for it to trigger an event which will cause yet more clientside script to perform the call back. Once the parent performs a call back to the server and reloads it's content then its DOM relationship with the child window is severed. Unless you have a deep understanding of the Document Object Model and are adept at using a clentside scripting lanuage and you have an IDE that has a clientside script debugger, I think you are on a hiding to nothing. But I wish you the very best of LUCK! Personaly I think your dad should give you the 50 rupees anyway just for making the attempt.
    End of Line.

  7. #6
    Member Arkantos's Avatar
    Join Date
    Jul 2005
    Posts
    66
    Member #
    10732
    thank you for the reply, arkette.
    you are right, dad's a wee bit touched in the attic.

    i may be wrong, but this is what i thought to solve the problem.

    there are javascript code-blocks, which refresh the page.

    my issues are two. the rest are sorted out.

    1) executing 2 codeblocks, one javascript, and one php, from one form submit button.

    2) opening the form action url in a popunder. (so when i press submit, the processor.php opens in the popunder)

    at the very least, i would like a solution to the popunder problem.,
    i can always tell dad to hit F5.

    can you help me with these two??

    warm regards.

    Arkantos.

    ps. i think dad should pay too. but he aint coughing up. sad luck
    No bastard ever won a war by dying for his country, he won it by making the other poor dumb bastard dying for his country.
    General George S. Patton (US Army)

  8. #7
    Senior Member Arkette's Avatar
    Join Date
    Jan 2006
    Location
    Europe
    Posts
    102
    Member #
    12297
    I'm sorry I can't offer any specific help on your problem, because I dont work in PHP (I'm an ASP.net man.) You might find this helpfull though.
    http://www.w3schools.com/htmldom/dom_obj_window.asp
    End of Line.

  9. #8
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    To open multiple popup windows, they need to be referenced by unique names. Otherwise, any attempts to open a new popup, will only reference the same.

    If you want to hide the popup behind the current window, use "blur()".

    Ex:
    Code:
    <html>
    <head>
    <script language="javascript">
    <!--
    //open the control panel window
    popup = new Array();
    
    function openPop(url, name, args) {
    if ( typeof( popup[name] ) != "object" ){
    popup[name] = window.open(url,name,args);
    } else {
    if (!popup[name].closed){
    popup[name].location.href = url;
    } else {
    popup[name] = window.open(url, name,args);
    }
    }
    
    popup[name].blur();
    }
    -->
    </script>
    <title>Untitled Document</title>
    </head>
    
    <body>
    <a href="#" OnClick="openPop('http://google.no','first','width=200,height=150'); return false;">Open pop one</a><br />
    <a href="#" OnClick="openPop('http://google.no','second','width=200,height=150'); return false;">Open pop two</a><br />
    <a href="#" OnClick="openPop('http://google.no','third','width=200,height=150'); return false;">Open pop three</a>
    </body>
    </html>
    S. Rosland

  10. #9
    Senior Member rosland's Avatar
    Join Date
    Jul 2003
    Location
    Norway
    Posts
    1,944
    Member #
    2096
    All the pop-up features require javascript, but is that what you really want?

    Apperantly, you don't need the pop-ups as you want to keep them hidden behind "base.php" anyway.
    What you want is to have "base.php" update whenever you submit info through your form. (with the info from the form I guess).

    If this is what you're trying to achieve, then it's quite easy.

    First you should incorporate all processing code from "processor.php" on the "base.php" page.
    Then you just encapsulate that code in "if/else" clauses. Same goes for your form.

    When a user opens "base.php", he will be presented with the form. When submitting the form, the action will be set to PHP_SELF, which means it submits to itself. You can add some value to a hidden variable when the form is submitted.

    When submitting the form, "base.php" will be called again. When the page is requested, the script will check for the mentioned variable. If it's not set, it will present the form. If it is set, it will present some other info normally hidden.
    The possible combinations are endless. You could have the form appear everytime and have the additional info, and/or have the form populated with (all or parts) of the previously posted data, etc.

    If you want different things to happen each time the form is submitted, you could create different responses based on what the value of the incrementing hidden variable is.

    If certain fields are mandatory, you could make the page halt and issue a warning if a given field is not set.
    You could have a predefined content that the user have to match. If he's unable to write the correct value (as in a user/password entry), you could issue a warning after two failed attempts, and block the page if he enters an erronous value three consecutive times, etc.

    Simple example:
    PHP Code:
    <html> 
    <head>
    <title>Test Demo</title>
    <style type="text/css">
    <!--
    .quote {color: #FF0000;}
    .tip {font-family: Verdana, Arial, Helvetica, sans-serif}
    -->
    </style>
    </head>

    <body>
    <?php
    if(@$_POST['text'])
    {
        @
    $string = @$_POST['string'];
        @
    $count $_POST['count'];
        @
    $count++;
        @
    $string .= "<p>Submission ".@$count.": <span class='quote'>&quot;".@$_POST['text']."&quot;</span></p>\n";
    }
    if(!@
    $_POST['revisit'])
    {
    ?> 
    <h2>Hi, this is the first time you open this page! </h2>
    <?php
    }
    else
    {
    ?>
    <h2>Hi, you've been here <?php echo @$count ?> time<?php if(@$count 1) echo 's' ?> before! </h2>
    <?php
    }
    ?>
    <form id="form1" method="post" action="<?php $PHP_SELF ?>">
      <p>
      <textarea name="text"></textarea>
      <span class="tip">Write your message here.</span><br />
      <input type="hidden" name="revisit" value="oldtimer" />
      <input type="hidden" name="count" value="<?php echo @$count ?>" />
      <input type="hidden" name="string" value="<?php echo htmlspecialchars(@$string?>" />
      <br />
      <input type="submit" name="Submit" value="Submit" />
      </p>
    </form>
    <?php
    echo @$string;
    ?>
    </body>
    </html>
    S. Rosland

  11. #10
    Member Arkantos's Avatar
    Join Date
    Jul 2005
    Posts
    66
    Member #
    10732
    thank you so much.

    i'll try to incorporate your ideas and codes into my project and get back to you.

    in gratitude,

    Arkantos.
    No bastard ever won a war by dying for his country, he won it by making the other poor dumb bastard dying for his country.
    General George S. Patton (US Army)


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

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

Search tags for this page

open popup on form submit

,

php form open thanks window popup

Click on a term to search for related topics.
All times are GMT -6. The time now is 09:12 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com