PHP and MySQL Code

Start typing to search for PHP and MySQL Code Snippets and Articles Search

Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
Title : How to populate an input field of type text from a select box with JavaScript.
Categories : Java Script
Boaz Yahav
Date : Aug 23rd 2001
Grade : 4 of 5 (graded 4 times)
Viewed : 11784
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Boaz Yahav
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 

Sometimes you need to allow users to choose a value from a select box (pull down menu) and
have the value they chose show up in another input field of type text (for example).

Here is how to do it :

Add this Jscript function to your page.

function UpdateField(index) {
form.TextFieldName.value = form.SelectFieldName.options[index].text

o FormName is the name of your <FORM>

o TextFieldName is the name of the field you want the Selected text to be in.

o SelectFieldName is the name of the Select field you are choosing from.

The call to the function should be like this :

<SELECT onChange="UpdateField(this.selectedIndex)"; NAME="SelectFieldName">

In case you want the value of the field and not the text that is shown in the pull down menu,
all you need to change is the next line in the function :

form.TextFieldName.value = form.SelectFieldName.options[index].text


form.TextFieldName.value = form.SelectFieldName.options[index].value

AJAX Data Grid System using php and mysql. A complete login system with the ability to display data in a grid using ajax. Add , update and delete the records without reloading the page.
Categories : PHP, AJAX, Databases, MySQL, Java Script
Run a function once per session.
Categories : Beginner Guides, Java Script, Cookies
The Ajax Tree view class fetches data from a db for the requested parent category id. The data is then stored in an array and converted into JSON (Javascript Object Notation) format. This format is then used by JavaScript for populating tree view.
Categories : PHP, PHP Classes, Java Script, AJAX, Databases
intro java applet example for beginners
Categories : Languages, Java Script
Form validations using javascript and including all validations in one message
Categories : HTML and PHP, Java Script, Form Processing
filesystem Show Files Script
Categories : PHP, Filesystem, Java Script
Fancy Quick Access Navigation Link
Categories : Java Script, Navigation, User Interface, DHTML, Beginner Guides
Calendars to choose a range of dates , reservation events ...
Categories : PHP, Calendar, Java Script, Date Time
Classic guest book made with PHP and Flash
Categories : PHP, Flash, Java Script
showing Help (assistance) to the user while filling html forms.
Categories : HTML, Java Script, Form Processing
Dynamic Loading of XML array data into ComboBox and Display XML data using PHP + DOM + Javascript.
Categories : PHP, Java Script, DOM XML, XML, Arrays
Java Script which implements a Clock (Client Side)
Categories : Java Script, Date Time
PHP Calendar
Categories : PHP, Calendar, Date Time, Java Script, CSS
Show and Hide Tables, Table Rows, Form Elements Etc.
Categories : Java Script, Beginner Guides
Menu in sliding bar or tree style. Handles frames by using small amount of javascript. Handles external and internal pages. Allows custom code to replace a menu item.
Categories : PHP Classes, PHP, Java Script, DHTML