display records in textbox using combo box

Reply

Join Date: Jul 2009
Posts: 15
Reputation: karin21 is an unknown quantity at this point 
Solved Threads: 0
karin21 karin21 is offline Offline
Newbie Poster

display records in textbox using combo box

 
0
  #1
Jul 1st, 2009
hi guys , i have this problem dealing with php its very simple but can anyone help me with this cause im only starting to learn this language and I don’t know where to start, its all about getting data from database using combo box , for example is when I select item in combo box it will display the price of the item into textbox and other details of the item from the database. I hope I make my self clear. Any example may do. Thank you in advance n_n

my first script
  1. $db_host = 'localhost';
  2. $db_user = '';
  3. $db_pass = '';
  4. $db_db = 'Inventory';
  5.  
  6.  
  7. $db_link = mysql_connect($db_host, $db_user, $db_pass) or die('MySQL Connection Error:'.mysql_error());
  8. mysql_select_db($db_db) or die('MySQL Error: Cannot select table');
  9.  
  10.  
  11. $sql = "SELECT item, id, unit_price, sellprice, quantity FROM product ORDER by id";
  12. $result = mysql_query($sql);
???
Last edited by Tekmaven; Jul 1st, 2009 at 6:36 pm. Reason: Code Tags
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 185
Reputation: aashishn86 is an unknown quantity at this point 
Solved Threads: 9
aashishn86's Avatar
aashishn86 aashishn86 is offline Offline
Junior Poster

Re: display records in textbox using combo box

 
0
  #2
Jul 1st, 2009
well there are a lot of examples for that on the net..
search for creating dynamic drop down lists...
rEaLITy iS aN iLLUSIOn cAUSED bY lACk oF aLCOHOL....
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 13
Reputation: Bojero is an unknown quantity at this point 
Solved Threads: 3
Bojero Bojero is offline Offline
Newbie Poster

Re: display records in textbox using combo box

 
0
  #3
Jul 2nd, 2009
Using ajax for this would make it even nicer. Also, you're not really asking much of a valid question but are rather asking someone to write the programme for you.

Here's how you do it, in English:
You receive all item's records from the database using a MySQL statement. The data is returned in the form of an array. Using the foreach() method, you can easily populate a combo box on a form.

When the combo box form is submitted, the current item is sent using GET or POST to your script getting the rest of the details about that item and shows the page using the item's details as the initial values in your input text boxes, inside the form.

Seems like an interesting project which could even be sold eventually. Good luck with it!
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 185
Reputation: aashishn86 is an unknown quantity at this point 
Solved Threads: 9
aashishn86's Avatar
aashishn86 aashishn86 is offline Offline
Junior Poster

Re: display records in textbox using combo box

 
0
  #4
Jul 2nd, 2009
Originally Posted by Bojero View Post
Seems like an interesting project which could even be sold eventually. Good luck with it!

i thought this was pretty common kind of a thing ...........!!!
rEaLITy iS aN iLLUSIOn cAUSED bY lACk oF aLCOHOL....
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 15
Reputation: karin21 is an unknown quantity at this point 
Solved Threads: 0
karin21 karin21 is offline Offline
Newbie Poster

Re: display records in textbox using combo box

 
0
  #5
Jul 4th, 2009
ok that would be helpful but so far im starting to learn php and i don't know ajax yet, is it possible to handle it in php? cause we are required to use php,.i've been searching for some examples on the web so that it would be easier for me to start and understand. hope some1 can help me T_T
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 185
Reputation: aashishn86 is an unknown quantity at this point 
Solved Threads: 9
aashishn86's Avatar
aashishn86 aashishn86 is offline Offline
Junior Poster

Re: display records in textbox using combo box

 
0
  #6
Jul 5th, 2009
u don't absolutely necessarily need 'ajax' for it...
rEaLITy iS aN iLLUSIOn cAUSED bY lACk oF aLCOHOL....
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC