dualshock03 Posted April 30, 2008 Share Posted April 30, 2008 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!! Link to comment https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/ Share on other sites More sharing options...
p2grace Posted April 30, 2008 Share Posted April 30, 2008 You'll either need to use ajax to display it, or generate all of the javascript when the page is accessed and use javascript to do it. Easiest method would probably be ajax. Link to comment https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-530421 Share on other sites More sharing options...
benphp Posted April 30, 2008 Share Posted April 30, 2008 onchange="javascript:document.myform.mytextbox.value=document.myform.mylist.value" Link to comment https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-530427 Share on other sites More sharing options...
947740 Posted April 30, 2008 Share Posted April 30, 2008 onchange="javascript:document.myform.mytextbox.value=document.myform.mylist.value" You could just make a function and call the function, passing a paramater too. Link to comment https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-530428 Share on other sites More sharing options...
dualshock03 Posted May 1, 2008 Author Share Posted May 1, 2008 Anyway what about this ajax? i dont know how to use it.. easiest? Link to comment https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-530805 Share on other sites More sharing options...
947740 Posted May 1, 2008 Share Posted May 1, 2008 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 https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-530996 Share on other sites More sharing options...
p2grace Posted May 1, 2008 Share Posted May 1, 2008 Check into xajax, I use it religiously http://xajaxproject.org Link to comment https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-531144 Share on other sites More sharing options...
dualshock03 Posted May 5, 2008 Author Share Posted May 5, 2008 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 https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-533495 Share on other sites More sharing options...
dualshock03 Posted May 6, 2008 Author Share Posted May 6, 2008 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 https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-534238 Share on other sites More sharing options...
DarkWater Posted May 6, 2008 Share Posted May 6, 2008 Okay. We understand what you said. You need to use Ajax to get the information from the PHP page and the database. We are NOT coding it for you, but we will help you code it. Link to comment https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-534239 Share on other sites More sharing options...
dualshock03 Posted May 6, 2008 Author Share Posted May 6, 2008 Ok.. im doing it with dreamweaver.. Using Spry Control Link to comment https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-534242 Share on other sites More sharing options...
dualshock03 Posted May 6, 2008 Author Share Posted May 6, 2008 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 https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-534251 Share on other sites More sharing options...
dualshock03 Posted May 8, 2008 Author Share Posted May 8, 2008 what will be? Link to comment https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-536039 Share on other sites More sharing options...
dualshock03 Posted May 8, 2008 Author Share Posted May 8, 2008 MY TOPIC IS SOLVED thanks for the tips! i just found this forum page which has match similar to my problem and it worked for me.. so easy to say than really done.. http://www.webmasterworld.com/forum88/6628.htm Link to comment https://forums.phpfreaks.com/topic/103580-solved-populating-textboxes-upon-selecting-from-dropdown-control/#findComment-536049 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.