Jump to content

update and refresh parent after making changes in a child window


tim452

Recommended Posts

Hey there!

 

i'm new on the forum n new to coding with php as well. Rite now, i'm having problems with the submit button of my child window. Actually  i want to enter a number in the child window and have the parent updated onclick of the "sve_phone" button. Can anyone please review them to suggest how i might solve the problem. Thx!  :)

 

here  r extracts of the essential codes in my child (which is in .vtp format btw):

 

 

<script type="text/javascript">

 

function pop()

    {

   

    if (opener && !opener.closed)

        {                                                                                          //opener is still open

        window.opener.document.bgColor = "beige";

        //var phne = document.getElementById("nphne").value;

 

        opener.document.frm_newphone.newphone.value=opener.document.frm_action.phone.value;

        window.opener.frm_newphone.snw_phone.value='save';

        window.opener.frm_newphone.submit();

        //self.close();

        window.opener.location.href=window.opener.location.href;

        if (window.opener.progressWindow)

          {

          window.opener.progressWindow.close()

          }

        window.close();

       

        //opener.document.getElementById("nphne").value = phne;

        opener.focus();       

       

        }

    }   

 

 

 

<form name="frm_newphone" enctype="multipart/form-data" method="post" action="popphone.php5">

 

<!--VTP_NewPhone--> 

 

    <tr>

    <td> <b> NEW PHONE NO. </b> </td>

    <td> <input type="text" value="{#newphone}" name="newphone" /> </td>

    </tr>     

   

    <tr>

    <td> <input type="button" name="sve_phone" value="Changer" onclick="pop();Chk_newPhne();" /> </td>

    </tr>

 

    <tr>

    <td> <input type="hidden" name="snw_phone" value="" /> </td>

    <td> <input type="hidden" name="actions" value="{#actions}" /> </td>

    </tr>

 

<!--/VTP_NewPhone-->

 

    <tr>

    <td> <b> <a href="javascript:window.close()"> CLOSE </a> </b> </td>

    </tr>

 

 

 

the corresponding extracts of my .php file follow below:

 

$vtp=new VTemplate();

$handle=$vtp->Open("popphone.vtp");

 

$NewId=($_GET['newpid']);     

 

if (($NewId!="")&&(isset($_POST['snw_phone'])))

{

//    if ($_POST['rec_id']!="" )

 

//      {

    $np_id=($_GET['newpid']);

 

    echo "xxxxxxxx";

 

    $Phone_update=pg_query("UPDATE info_utilisateur SET iut_telephone='".$_POST['newphone']."' WHERE iut_id=".$np_id)                               

    or die('Query failed: ' . pg_last_error());

 

    echo '<br>sql query'.$Phone_update ;

   

    if (!$Phone_update)

    {

    echo "An error occured.\n";

    exit;

    }

$vtp->Display(); 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.