Click here to Skip to main content
15,039,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted

1 solution

Start with learning few topics:
1. Javascript
2. AJAX
3. JSON

Lots of people would suggest you to learn JQuery as well. I will not suggest that. I will not argue against it either.

What would be the process:
1. Write your php code to get data from mysql. Finally echo them in JSON format. If you want to do it in easy way then aggregate all data in an array and then use json_encode function. example:

PHP
$result=mysql_query("SELECT * FROM sometable", $conn);
$outputrow=array();
$i=0;
while($row=mysql_fetch_assoc($result))
{
 $outputrow[$i]=$row;
 $i++;
}
echo json_encode($outputrow);


2. Write the Ajax code to call the module from your client.
3. On return parse the returned data and then put the data on their proper element.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900