Using JavaScript To Call PHP Database Routines Between Windows

March 24, 2004

[From PHPBuilder]

In an effort to bring high ease of use, some of us provide a HTML styled select or drop-down list of selections the user can make. It's not too hard to have PHP build a variable that holds a select option list such as:

$OptionList = ""; $First = 1;
while ($Row = mysql_fetch_array($Result, MYSQL_ASSOC)) 
    $ContactID = $Row["ContactID"];
    $Company = $Row["Company"];
    if ($First) 
        $SelMsg = " selected"; $First = 0;
        $SelMsg = "";
    $Line = "<option value='".$ContactID."'".$SelMsg.">".$Company."<l/option>\n";
    $OptionList .= $Line;

We might (I do) have a button on a main screen that says [Select Contact] for the user to make their selection in a second window. This first window has a JavaScript function that opens a PHP page to bring back a number of values from the Contacts database like Company and Name, as read via a key value the user can supply in a form.

The article continues at http://www.phpbuilder.com/columns/gruskoff20040320.php3

The Network for Technology Professionals


About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers