PHPBuilder - Using JavaScript To Call PHP Database Routines Between Windows

RSS Twitter

Using JavaScript To Call PHP Database Routines Between Windows

by: Alan Gruskoff
March 23, 2004

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:

""$First 1;
while (
$Row mysql_fetch_array($ResultMYSQL_ASSOC)) 
$ContactID $Row["ContactID"];
$Company $Row["Company"];
    if (
$SelMsg " selected"$First 0;
$SelMsg "";
$Line "<option value='".$ContactID."'".$SelMsg.">".$Company."</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 first screen then contains this JavaScript function to just go "read" a Contacts record. The PHP screen GetVals.php is my own database read-and-post-back generic utility.
var newWin3 = null;
function doContactID() {
var ContactID = document.forms.BoothUpd.ContactID.value;
var URL = '../code/GetVals.php?Filename=Contacts&IDname=ContactID&IDval=
' + ContactID + '&Fields=Company,Type,RepID';
var params = 'top=20,left=80,width=300,height=200,minimized=yes,resizable=yes,
if (!newWin3 || newWin3.closed) {
newWin3 =,"",params);
if (newWin3.opener == null) {
newWin3.opener = self;

Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Alan Gruskoff



(Maximum characters: 1200). You have characters left.