#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    10
    Rep Power
    0
    How do I edit a client record in a new window using javascript and PHP?

    I query a client database and add links to the #'s of the records returned. I want to link on that record no (id) to open a new window so i can edit that record. How do a pass the id no to javascript so javascript opens the correct record in the new window?

    part of the PHP routine
    .
    .
    .
    <script language="JavaScript">
    function clientwindow(idsel)
    {
    window.open('clientedit.php3?id=idsel','Client','width=400,height=450,directories=no,location=no,men ubar=no,status=no,toolbar=no,resizable=no,left=150,top=150,screenX=150,screenY=1 50')
    }
    </script>
    // the clientedit.php routine works
    .
    .
    .
    // this part seems to work
    $id=result["id"];
    $id="<a href="javascript:clientwindow($id)">".$id."</a>";
    .
    .
    .
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15


    <script language="JavaScript">
    function clientwindow(idsel)
    {
    window.open('clientedit.php3?id=idsel','Client','width=400,height=450,directories=no,location=no,men ubar=no,status=no,toolbar=no,resizable=no,left=150,top=150,screenX=150,screenY=1 50')
    }
    </script>


    first of all
    you will have to concatenate "idsel" variable.other wise it wont condider this as a variable.

    //window.open('clientedit.php3?id='+idsel+',

    just print this java script in side your php script.

    echo "<script language="JavaScript">n";
    echo "function clientwindow(idsel)n";
    echo "{window.open('clientedit.php3?id='+idsel+','Client','width=400,height=450,directories=no,location=n o,menubar=no,status=no,toolbar=no,resizable=no,left=150,top=150,screenX=15 0,screenY=1 50')}n";
    echo "</script>n";

    see whether the above thing is working or not..





    ------------------
    SR -
    shiju.dreamcenter.net

    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    10
    Rep Power
    0
    Thanks for the code. I had to make a minor change to 1 line. I moved the code back out of php and it still works. I was originally missing the + sign and had the ' in the wrong place. Thanks again. It works great.

    {window.open('clientedit.php3?id='+idsel,'Client','width=400,height=450,directories=no,location=no,m enubar=no,status=no,toolbar=no,resizable=no,left=150,top=150,screenX=150,screenY =150')}

Similar Threads

  1. calendar with popup for each day not opening window
    By squalle in forum HTML Programming
    Replies: 0
    Last Post: January 31st, 2004, 04:34 PM
  2. Setting window focus with javascript
    By jayhay in forum JavaScript Development
    Replies: 0
    Last Post: January 28th, 2004, 05:28 AM
  3. help with javascript that opens a broswer window
    By Nullified in forum JavaScript Development
    Replies: 2
    Last Post: January 23rd, 2004, 02:51 AM
  4. Problem Javascript Window Opening
    By ascollins in forum JavaScript Development
    Replies: 3
    Last Post: January 18th, 2004, 05:52 PM
  5. Replies: 1
    Last Post: November 20th, 2003, 01:43 AM

IMN logo majestic logo threadwatch logo seochat tools logo