Results 1 to 10 of 10

Thread: [PHP] Open new window for update

  1. #1

    Thread Starter
    Member disinwebe's Avatar
    Join Date
    Oct 2005
    Location
    Philippines
    Posts
    38

    [PHP] Open new window for update

    Hi.. it's been a long time to post here.
    I'm a new coder in PHP and i have some problem on my first project.

    i just want to have a popup window where i can update my database regarding on what record no that i click.

    here's some of my poor code (sorry im a newbie).. hope you understand my problem guys..

    thanks a lot...

    PHP Code:
    <script type="text/javascript" language="javascript">
    function OpenWindow() 
    {
            window.open ('UpdateASUSLack.php','','width=200,height=100')
            
    }
    </script>


    <?php
    $lackQuery
    =mysql_query("select * from tbl_asus_lacking WHERE status='Open'");

    while (
    $Result=mysql_fetch_array($lackQuery))
    {
        echo 
    "<tr>";
        echo 
    "<form action='ViewASUSLacking.php' method='post'>";
        echo 
    "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['UnitPN']."</td>";
        echo 
    "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['UnitDesc']."</td>";
        echo 
    "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['OldSN']."</td>";
        echo 
    "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['NewSN']."</td>";
        echo 
    "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['LackPN']."</td>";
        echo 
    "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['LackDesc']."</td>";
        echo 
    "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['Customer']."</td>";
        echo 
    "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['Location']."</td>";
        echo 
    "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['RMANo']."</td>";
        echo 
    "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['Station']."</td>";
        echo 
    "<td class='text1' bgcolor='$bgcolor' align='left'>".$Result['inputDate']."</td>";
        echo 
    "<td class='text1' align='center' bgcolor='$bgcolor'>"."<input type='submit' name='close' value='update' id='$Result[RecNo]' onclick='OpenWindow()'>"."</td>";
        echo 
    "</form>";
    }
    ?>

  2. #2

    Thread Starter
    Member disinwebe's Avatar
    Join Date
    Oct 2005
    Location
    Philippines
    Posts
    38

    Re: [PHP] Open new window for update

    the problem is i dont know how can i display the record no from my opener window to new window.

    and the new window will let me update the data based on record no will show up (which came from the window.opener) on new window.

    please kinldy help me.
    thanks in advanced.
    Last edited by disinwebe; Jun 19th, 2013 at 03:34 AM.

  3. #3

    Thread Starter
    Member disinwebe's Avatar
    Join Date
    Oct 2005
    Location
    Philippines
    Posts
    38

    Re: [PHP] Open new window for update

    This could be help.
    Name:  6-19-2013 4-30-54 PM.png
Views: 130
Size:  27.1 KB

  4. #4
    Addicted Member Pc Monk's Avatar
    Join Date
    Feb 2010
    Posts
    188

    Re: [PHP] Open new window for update

    i was thinking what i was gonna tell you since i was reading another post...hope this post will help you since i cannot access the internet in here (they say its for security reason) anyway, if you are trying to have another window popup you should use java-script for that..but you can redirect the user to another page by using header function for php or meta refresh for html. since you are using window.open , and regarding to your #3 post if its a page you can use onclick event to popup a simple window instead of a new page to edit any record , a little bit more information would be good for other ppl that would check this thread
    Good Day
    Body Language tells the truth! even from the grave tsaeb eht morf gninnur ,nwod deaH
    All the big things started from little! teef my tsap evom sekans ,duol raor slluB
    Lietome.ir

  5. #5

    Thread Starter
    Member disinwebe's Avatar
    Join Date
    Oct 2005
    Location
    Philippines
    Posts
    38

    Re: [PHP] Open new window for update

    hope somebody will understand this.. thanks..

    Name:  6-19-2013 4-30-54 PM.png
Views: 277
Size:  73.0 KB

  6. #6
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: [PHP] Open new window for update

    Why are you echoing html? That is bad practice! PHP and html should be kept separate. What are the ids of the text boxes on the window that pops up?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  7. #7

    Thread Starter
    Member disinwebe's Avatar
    Join Date
    Oct 2005
    Location
    Philippines
    Posts
    38

    Re: [PHP] Open new window for update

    sorry for my code.. maybe i will learn on how to separate HTML and PHP one of this days.
    i will try to study it.

    and here's my code for the pop up window:
    PHP Code:
        echo "<table class='original' cellspacing='1' border='0'>";
        echo 
    "<form action='ViewASUSLacking.php' method='post'>";
        echo 
    "<td class='text2' bgcolor='e3e6e5' height='40'>"."UNIT P/N:"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='UnitPN'>"."</td>";
        echo 
    "<tr>";
        echo 
    "<td class='text2' bgcolor='e3e6e5'>"."MODEL:"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='Model'>"."</td>";
        echo 
    "<tr>";
        echo 
    "<td class='text2' bgcolor='e3e6e5'>"."SERIAL #"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='oldSerial'>"."</td>";
        echo 
    "<tr>";
        echo 
    "<td class='text2' bgcolor='e3e6e5'>"."NEW SERIAL #"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='newSerial'>"."</td>";
        echo 
    "<tr>";
        echo 
    "<td class='text2' bgcolor='e3e6e5'>"."LACKING P/N"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='lackPN'>"."</td>";
        echo 
    "<tr>";
        echo 
    "<td class='text2' bgcolor='e3e6e5'>"."DESCRIPTION"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='lackDesc'>"."</td>";
        echo 
    "<tr>";
        echo 
    "<td class='text2' bgcolor='e3e6e5'>"."CUSTOMER"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='customer'>"."</td>";
        echo 
    "<tr>";
        echo 
    "<td class='text2' bgcolor='e3e6e5'>"."LOCATION"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='location'>"."</td>";
        echo 
    "<tr>";
        echo 
    "<td class='text2' bgcolor='e3e6e5'>"."RMA #"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='RMANo'>"."</td>";
        echo 
    "<tr>";
        echo 
    "<td class='text2' bgcolor='e3e6e5'>"."STATION"."</td>"."<td class='text1'bgcolor='e3e6e5' height='20'>"."<input type='text' name='station'>"."</td>";
        echo 
    "<tr>";
        echo 
    "<tr>";
        echo 
    "<tr>";
        echo 
    "<tr>";
        echo 
    "<tr>";
        echo 
    "<tr>";
        echo 
    "<td class='text1' align='right'>"."<td class='text1' align='right'><input type='submit' value='Update' name='close'>"."</td>"."</td>";
        echo 
    "</form>"
    Last edited by disinwebe; Jun 20th, 2013 at 03:24 AM.

  8. #8

    Thread Starter
    Member disinwebe's Avatar
    Join Date
    Oct 2005
    Location
    Philippines
    Posts
    38

    Re: [PHP] Open new window for update

    please help
    thanks.

  9. #9

    Thread Starter
    Member disinwebe's Avatar
    Join Date
    Oct 2005
    Location
    Philippines
    Posts
    38

    Re: [PHP] Open new window for update

    i see this post in JAVASCRIPT forum.
    may i kindly ask how can i apply this one in my PHP project?
    Thanks.

    http://www.vbforums.com/showthread.p...=2#post3256067

  10. #10
    Addicted Member Pc Monk's Avatar
    Join Date
    Feb 2010
    Posts
    188

    Re: [PHP] Open new window for update

    Quote Originally Posted by disinwebe View Post
    i see this post in JAVASCRIPT forum.
    may i kindly ask how can i apply this one in my PHP project?
    Thanks.

    http://www.vbforums.com/showthread.p...=2#post3256067
    hope i'm not still late and u checking this post... its a long story how you can use the post method in javascript you have to defined which of the div in html sending the data for javascript since i still dont have access to any kind of compiler i try explain it to you
    1- after you made ur html page you have to give it a specific id so you can use it for javascript remember to use <DIV>
    2- after you check if the data is send you have to get the element by id
    3- txtData2.value = window.opener.document.getElementById('YOUR ID').value;
    4- you have to send the data to database

    like i said its a lot of code i just explain it to you in a snap of a finger google post data in javascript and you will find helpful codes
    GoodDuck
    Last edited by Pc Monk; Jun 29th, 2013 at 11:07 AM.
    Body Language tells the truth! even from the grave tsaeb eht morf gninnur ,nwod deaH
    All the big things started from little! teef my tsap evom sekans ,duol raor slluB
    Lietome.ir

Posting Permissions

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



Click Here to Expand Forum to Full Width