![]() |
| ||
| How do i display records of an item into textbox based on drop down list hi, i have a script here which display an item name from database into textfield based on the combo box selection, i cn display the item name but my problem is i dont know how to display the item information into the textbox? i'm required to use php but i think it can handle by javascript, hope my simple explanation works n_n ex. item color apple red car blue <script type="text/javascript" language="javascript"> |
| ||
| Re: How do i display records of an item into textbox based on drop down list Your thread is belongs to PHP forum. |
| ||
| Re: How do i display records of an item into textbox based on drop down list i think this is a PHP forum |
| ||
| Re: How do i display records of an item into textbox based on drop down list You will definitely need a server-side language to get info from a database. pHp with MySQL is great. If you have a dropdown (select) you can use AJAX to retrieve info into a textarea. I suggest that you use something like the Prototype library to deal with the ajax implementation. 1. Download this from http://www.prototypejs.org (currently version 1.6). 2. Place this file into a folder, e.g. "/js/" 3. Create a new js file, e.g. custom.js and place it in the same folder. 4. Link the two js files to the php file's head area. 5. Create the form select widget via php or use static html. e.g. for php: <select name="m1" id="m1" onchange="popMe();return false">6. Write the popMe() function in your custom.js file: function popMe(){7. Write the php code for getting the data and call the file getrecs.php....DB connection details...That's it. I haven't checked the code, it's off the top of my head, so there may be typos or something, but it's pretty close. |
| ||
| Re: How do i display records of an item into textbox based on drop down list Karin, I see a couple problems. First, you're not accessing the right column name for the color. The SELECT statement says it's 'colorinfo', but when you access it, it's as 'color'. Change the assignment line to: $display_color=$row['colorinfo'];and the following line to echo "<option value='$display_color'>$display_name</option>"; In that JavaScript function, use the following line to get both the color and name into the textarea: textarea.value += opt.innerHTML + ' ' + opt.value + '\n'; -steve |
| ||
| Re: How do i display records of an item into textbox based on drop down list ok mr.ardav and mr.steve thanks for the help i will try your solutions at home |
| All times are GMT -4. The time now is 1:59 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC