What I'm trying to make is something like this. jsfiddle.net/zunrk/ I want to create a receipt that when you pick the data from the drop down it will show the details on other text box. The other problem is that i wanna create multiple textbox because there will be multiple items to be inserted. But i want the items coming from the mysql database not from an array.

There are a few options here.

/* BEFORE PAGE IS SENT */

1. When the page loads, grab the array you need from the database and pass it along to javascript with json_encode().

/* AFTER PAGE IS SENT */

2. Use AJAX's asynchronous xhr to a file that grabs that db array and use it directly in javascript.

2.1. If you're using jQuery you'll have the .post() method that has a callback with a data parameter that will be the array you recieve from that file, but it's basically an ajax request but with jQuery shorthand, just usefull if you're using it

Let us know what you've tried so we can try to give you an extra push^^