Jump to content

[SOLVED] Populating textboxes upon selecting from dropdown control


dualshock03

Recommended Posts

pratically im stilll a newbie to this PHP Dreamweaver coding.. and im still on the basics using notepad..

 

i want to know how to populate the data to  the textbox and labels upon selecting a "record"/ or a "word" list,  from a drop down list control in dreamweaver... the drop down list is database dependent " i mean the lists are from the database and then whenever i choose one list, its corresponding records will appear from the lables, textboxes some list/menus..

 

Hope anyone will give me some good samples.. cheers!! 8)

Link to comment
Share on other sites

All I know about AJAX is that it can be used to update webpages without having to reload the webpage.  It is an entirely different language, but there are going to be scripts on the internet that you could use for your own use (at least I would imagine there would be).

Link to comment
Share on other sites

hey guys... im coming back to this thread... what if i want to generate its corresponding column records in the database just like searching records:

 

(DROP DOWN)= list are from the db in column "towname"

 

-town1

-town2

-town3

 

----------------

when i click one of the lists... "for exmple i choose "town1" "

then the result on the textbox, labels, and some imageplaceholders will be...

 

textbox = population data of town1

label =  town name data of town1

image placeholder = image data of town1

etc...

 

how will i code it in javascript or in PHP??

 

 

 

 

 

Link to comment
Share on other sites

anyone??

 

generating its corresponding column records in the database just like searching records:

 

(DROP DOWN CONTROL)= list are from the db in column "towname"

 

-town1

-town2

-town3

----------------

when i click one of the lists... "for exmple i choose "town1" "

then the result on the textbox, labels, and some imageplaceholders will be...

 

textbox = population data of town1

label =  town name data of town1

image placeholder = image data of town1

etc...

 

how will i code it in javascript or in PHP??

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

ok  i already try this codings.. but the result is... all the controls are empty.. the drop down,textbox and the rest became empty.. conflict on mysql query i think..

 

 

mysql query:

 

if (isset($_GET['towname'])) {
  $coldata_list_town_rec = $_GET['towname'];
}
mysql_select_db($database_mySQL, $mySQL);

$query_list_town_rec = sprintf("SELECT towname, num_brgy, townhistory, townborn, town_pop, general_info FROM tbltowns where towname LIKE %s ", GetSQLValueString("%" . $coldata_list_town_rec . "%", "text"));

$list_town_rec = mysql_query($query_list_town_rec, $mySQL) or die(mysql_error());
$row_list_town_rec = mysql_fetch_assoc($list_town_rec);
$totalRows_list_town_rec = mysql_num_rows($list_town_rec);
?>

 

 

<form action="/lcr8/townspots.php" method="post" name="formdropdown" id="formdropdown">
    <label> </MM:DECORATION>
    </MM_REPEATEDREGION>
    <MM_REPEATEDREGION SOURCE="@@rs@@">
    </label>
    <span id="spryselect1">
    <label>
    <select name="towname" id="towname">
      <option value="value">Select Municipality...</option>
      
<?php
          do {  ?>
      <option value="<?php echo $row_list_town_rec['towname']?>"><?php echo $row_list_town_rec ['towname']?></option>
      <?php
} while ($row_list_town_rec = mysql_fetch_assoc($list_town_rec));
  $rows = mysql_num_rows($list_town_rec);
  if($rows > 0) {
      mysql_data_seek($list_town_rec, 0);
  $row_list_town_rec = mysql_fetch_assoc($list_town_rec);
  }
?>
    </select>
    </label>
    <span class="selectRequiredMsg">Please select an item.</span>    </span>
  </form>

Link to comment
Share on other sites

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.