Dear,
I have a form containing a drop down menu, that contains Advertiser's names selected from an sql table. I want to create a table under this drop down menu contains the fields related to the value of the drop down menu chosen..
and on change of drop down menu I need that the data on the table below will be changed .

<select size="1" name="advertiser" style="font-size: 13pt; font-family: arial">
<option value="empty" selected>-------------------</option>

<?php
include("connect_banners.php");
$q = "SELECT Advertiser FROM Stat";
if($r=odbc_exec($sqlconnect, $q))
while($row=odbc_fetch_row($r))
{
$Advertiser = odbc_result($r,"Advertiser");

              print"<option value=\"$Advertiser\">$Advertiser</option>";
                   }

?>

</select>

<input type="submit" value="Show" name="button"></p>

any suggestions please

    AJAX. You could send the ID of the advertiser back to a php script which gets the data you want, then sends it back as either (a) a JSON object or (b) a complete table. Then in Javascript, you just put that table in the DOM.

      Thanks

      but please can you help me on how to send it as a complete table,
      here is my php function

      function submit($advertiser)
      {
      include("connect_banners.php");
      $q = "SELECT date_start,date_end, location, Advertiser FROM Stat";
      if($r=odbc_exec($sqlconnect, $q))
      while($row=odbc_fetch_row($r))
      {

             $Advertiser = odbc_result($r,"Advertiser");
      	   $start = odbc_result($r,"date_start"); 
             $end = odbc_result($r,"date_end");
             $location = odbc_result($r,"location");
          }

      }

      thank you

        Write a Reply...