Hi there,
I am still finding my way in the world of PHP. I recently found out about AJAX and am trying to use it on an order form.
A Customer can have many Contacts.
My dynamic select works like this.
Th onchange event fires as expected and AJAX populates the customer contact's phone number etc.
What I would like to have happen is if the user is editing an existing record...the "showUser" routine will fire and fill in the existing extra details (phone/email etc)
Currently I have to manually select another option before this event fires.
Is there another event I can call to fire the function?
If this post is more appropriate in the Javascript forum, I apologise in advance.
Thanks for any ideas you may have.
Peter.
Remember- It's nice to be important,
but it's important to be nice
I am still finding my way in the world of PHP. I recently found out about AJAX and am trying to use it on an order form.
A Customer can have many Contacts.
My dynamic select works like this.
Code:
<td><select name="CustomerContactID" onchange="showUser(this.value)">
<option value ="0">-Select Contact-</option>
<?php
// Build the SQL for the Contact Select
$sql = "Select CustomerContactID, ContactName FROM customercontacts WHERE CustomerID = ".$CustomerID." ORDER BY ContactName ASC";
// Run the query.
$results = conn($sql);
//Loop through the recordset.
while ($row = mysql_fetch_row($results)){
$selected = "";
if( $ContactName == $row[1]) {
$selected = "selected";
}
$display .= '<option value="'.$row[0].'"' . $selected . ">" . $row[1] . "</option>\n";
} // End while loop.
echo $display;
?>
</select>
Th onchange event fires as expected and AJAX populates the customer contact's phone number etc.
What I would like to have happen is if the user is editing an existing record...the "showUser" routine will fire and fill in the existing extra details (phone/email etc)
Currently I have to manually select another option before this event fires.
Is there another event I can call to fire the function?
If this post is more appropriate in the Javascript forum, I apologise in advance.
Thanks for any ideas you may have.
Peter.
Remember- It's nice to be important,
but it's important to be nice