UNIX Systems Administrator (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume

Using JavaScript To Call PHP Database Routines Between Windows
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:

<?php
$OptionList
= ""; $First = 1;
while (
$Row = mysql_fetch_array($Result, MYSQL_ASSOC))
{
    
$ContactID = $Row["ContactID"];
    
$Company = $Row["Company"];
    if (
$First)
    {
        
$SelMsg = " selected"; $First = 0;
    }
    else
    {
        
$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,
scrollbars=no,titlebar=no,menubar=no,status=no';
if (!newWin3 || newWin3.closed) {
newWin3 = window.open(URL,"",params);
}
if (newWin3.opener == null) {
newWin3.opener = self;
}
newWin3.focus();
}
[ Next Page ]


Comments:
How to select multiple valve from the dropdowDevendra Singh Sengar11/06/05 08:59
I understood clearlyArunmohan07/29/05 20:54
more usefull functionsEd van den Berg07/29/05 17:39
very confusinghabeeb12/06/04 15:44
very confusinghabeeb12/06/04 15:44
RE: Not clear Jobin Augustine08/09/04 07:13
RE: Not clear Jobin Augustine08/09/04 05:08
Not clear Francesco05/10/04 06:58
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.