Jump to content

Recommended Posts

Hi All,

I have a list box that is populated directly from an ever growing database feeder table. This works fine,

The feeder table has the followign structure

CustomerID        CustomerName        CustCategory
1                      Airtours                  Tourist Industry
2                      MacDonanlds          Food Industry

The listbox is found on a form, once submitted the main value (CustomerName) from the list box is entered into another database table

What I also need to do is extract the CustCategory of the selected and place this into a variable on the click event of the listbox.

I then want to automatically populate another textfield on the form with this variable to be submitted into the database.

Here is my cod efor the list box.

  <?php
  $conn = db_connect();
  $query_client = "SELECT * FROM tblClients ORDER BY CustomerName ASC";
  $result_client =  sql_return($query_client);
  $result_client = mysql_query($query_client);
  ?>
<td width="27%" valign="bottom"> <div align="left">       
<?php
  print "<SELECT NAME=CustomerName>";
  print "<OPTION>Please Select....</OPTION>";
          while($client_info = mysql_fetch_array($result_client))
  {
    $CustomerID=$clent_info['CustomerID'];
  $CustomerName=$client_info['CustomerName'];
$CustCategory=$client_info['CustCategory'];
  echo $CustomerID;
  print "<OPTION value='$CustomerID'>$CustomerName</OPTION>";
    }
  print "</SELECT><br><br>";
  ?>


  $conn = db_connect(); is in an include file and works fine.

Many thanks in advance.

Jamie

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.