Thread: PHP/Javascript

Page 2 of 2 First 12
  • Jump to page:
    #16
  1. Wiser? Not exactly.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    5,952
    Rep Power
    4033
    XeneX
    kicken, are you the same kicken from DALnet #php ?
    Yep.

    lloydie-t, I'm getting a little more confused as the thread goes on, but here is what I gather from what you are trying to do.

    Someone goes to your page, and you have a pop-up window that lists different customers and has a link that people can click. When the click that link, it reload the main window w/ that customers information. Doing this, you'd have a setup like this kinda.

    First page, Main window:
    //To open the popup
    window.open('customer_popup.php','whatever','parameters');


    customer_popup.php:
    //Do whatever you need to get the customer information, make a link like this to reload the main window.
    <A HREF="javascript:window.opener.location.href='customer_info.php';void(0);">Customer Information</A>

    To make a close link in the popup, you can do this:
    <A HREF="javascript:self.close();">Close</A>


    If I'm wrong in my understanding, please let know and maybe give a few more details.
  2. #17
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2002
    Location
    UK
    Posts
    563
    Rep Power
    13
    Kicken. You dont give in. I nearly had. Anyway this where we are at and what is working:

    PHP Code:
    <?

    print "<td bgcolor=\"$bgcolor\"><A HREF=\"javascript:window.opener.location.href='customeradmin.php?cust_id={$row['cust_id']}';void(0);\">{$row['cust_name']}</a></td>"

    ?>
    All I need to do now is close the window when this link is click. Hopefully you can point me in the right direction.
  4. #18
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2002
    Location
    UK
    Posts
    563
    Rep Power
    13
    Thank Gawd for that. I think we have cracked it. Find the following working code. Thanx everyone.

    PHP Code:

    <?
    $query 
    "select * from customer where cust_name like '%$company%' "

    $queryResult mysql_query($query); 

    $i=0;
    while(
    $row=mysql_Fetch_array($queryResult)) 
    {
       
    // if $i%2 is 0, the number is even, otherwise it will be odd.  
       
    $bgcolor=($i%2==0)?"#cccccc":"#ffcc99";
        print 
    "<tr>"
        print 
    "<td>"
        print 
    "<td bgcolor=\"$bgcolor\">{$row['cust_id']}</td>"
    print 
    "<td bgcolor=\"$bgcolor\"><A HREF=\"javascript:window.opener.location.href='customeradmin.php?cust_id={$row['cust_id']}';void(0);self.close();\">{$row['cust_name']}</a></td>";  
        print 
    "<td bgcolor=\"$bgcolor\">{$row['postcode']}</td>"
        print 
    "<td bgcolor=\"$bgcolor\">{$row['cust_phone']}</td>"
        print 
    "</tr>"
        
    $i++;
    }
    ?>
  6. #19
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2001
    Posts
    645
    Rep Power
    0
    Originally posted by lloydie-t
    Hi scoutt. I got the old error 404 message. I have look at some tutorials and what you have done al looks good. weird. Just one thing what is 'test' for?
    the test is suppose to be the name of the page. if you get an 404 error that means your php page is not found. if you have it working then I won't go into this anymore.
  8. #20
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2002
    Location
    UK
    Posts
    563
    Rep Power
    13
    Hi scoutt, As I thought so I tried changing test to the page name same result. Anyway all sorted now.
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo