pull values from database and populate popup using php and javascript

Discussion in 'Javascript' started by jsd219, Oct 17, 2007.

  1. jsd219

    jsd219 Guest

    Hi all, I know this is an elementary question but I am at a loss. I
    have googled and searched but can not find the answer. My knowledge of
    javascript is infant at best. I have a database driven site coded in
    php, on the 'display_trip.php' page the user sees a list of possible
    trips and with dates. I would like to code it so when the user clicks
    on one of the trips a popup window opens with the value stored in the
    content field of the database for that particular trip. I have figured
    out how to create a popup window for images but not how to pass info
    from a query.

    below are snippits of my code:

    File Name: display_trip.php
    ------------------------------------------------------------------------------------------------------------
    as you can see I am calling the content field in my query.

    $query = "SELECT TRIP_ID, TRIP_TITLE, TRIP_THUMB, TRIP_CONTENT
    FROM TRIPS
    WHERE TRIP_ID != ''";
    ------------------------------------------------------------------------------------------------------------
    $chref = "<a class=triplink href=\"javascript:OpenEvent('";
    -----------------------------------------------------------------------------------------------------------
    here is part of my echo statement to create the link:

    "<td align=\"left\">" . "&nbsp;&nbsp;" . "{$chref}{$row['TRIP_ID']}')
    \">" . "{$row['TRIP_TITLE']} " . "</td>" .
    ------------------------------------------------------------------------------------------------------------


    File Name: header.php file
    ------------------------------------------------------------------------------------------------------------
    here is my javascript function from my header.php

    function OpenEvent(id)
    {
    window.open ('SOMETHING NEED TO GO HERE' + id, 'newwindow',
    config='height=450, width=550, toolbar=no, menubar=no, scrollbars=no,
    resizable=no, location=no, directories=no, status=no')
    }
    ---------------------------------------------------------------------------------------------------------------
    Any help would be greatly appreciated

    God bless
    jason
    jsd219, Oct 17, 2007
    #1
    1. Advertising

  2. On Oct 17, 7:58 am, jsd219 <> wrote:
    > Hi all, I know this is an elementary question but I am at a loss. I
    > have googled and searched but can not find the answer. My knowledge of
    > javascript is infant at best. I have a database driven site coded in
    > php, on the 'display_trip.php' page the user sees a list of possible
    > trips and with dates. I would like to code it so when the user clicks
    > on one of the trips a popup window opens with the value stored in the
    > content field of the database for that particular trip. I have figured
    > out how to create a popup window for images but not how to pass info
    > from a query.
    >
    > below are snippits of my code:
    >
    > File Name: display_trip.php
    > ------------------------------------------------------------------------------------------------------------
    > as you can see I am calling the content field in my query.
    >
    > $query = "SELECT TRIP_ID, TRIP_TITLE, TRIP_THUMB, TRIP_CONTENT
    > FROM TRIPS
    > WHERE TRIP_ID != ''";
    > ------------------------------------------------------------------------------------------------------------
    > $chref = "<a class=triplink href=\"javascript:OpenEvent('";
    > -----------------------------------------------------------------------------------------------------------
    > here is part of my echo statement to create the link:
    >
    > "<td align=\"left\">" . "&nbsp;&nbsp;" . "{$chref}{$row['TRIP_ID']}')
    > \">" . "{$row['TRIP_TITLE']} " . "</td>" .
    > ------------------------------------------------------------------------------------------------------------
    >
    > File Name: header.php file
    > ------------------------------------------------------------------------------------------------------------
    > here is my javascript function from my header.php
    >
    > function OpenEvent(id)
    > {
    > window.open ('SOMETHING NEED TO GO HERE' + id, 'newwindow',
    > config='height=450, width=550, toolbar=no, menubar=no, scrollbars=no,
    > resizable=no, location=no, directories=no, status=no')
    > }


    I'm guessing you want 'SOMETHING NEED TO GO HERE' to be something like
    '/path/to/script.php?TRIP_ID='

    the '+ id' will then complete the query string (ie the part of the URL
    after the question mark.)


    Peter
    Peter Michaux, Oct 17, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jt

    populate pull-down menu

    jt, Apr 8, 2004, in forum: Java
    Replies:
    1
    Views:
    399
    Tony Morris
    Apr 8, 2004
  2. Replies:
    2
    Views:
    2,140
    Mike Treseler
    Jun 28, 2006
  3. Rajive Narain
    Replies:
    0
    Views:
    1,545
    Rajive Narain
    Sep 18, 2009
  4. Enjoy Life
    Replies:
    2
    Views:
    256
    Roland Hall
    Feb 23, 2005
  5. Nick
    Replies:
    0
    Views:
    74
Loading...

Share This Page