Alith7 Posted February 20, 2009 Share Posted February 20, 2009 I have a quoting database system that my boss would like to dynamically populate the fields for new quotes when you select the customer from a dropdown list. The customer DB has all the info, and I would have pulled the full DB when the page loaded. I just need a piece of script to take cust_ID and pull the info when selected and insert it into the appropriate fields. I can figure out the script for most of it, just not sure even where to start to pull the specific data. Here is the coding that I have right now: <td width="200" height="25"><div align="right"> <h2>Customer:</h2> </div></td> <td><select name="cust_id" id="cust_id"> <?php do { ?> <option value="<?php echo $row_listCustomer['cust_id']?>"><?php echo $row_listCustomer['name']?></option> <?php } while ($row_listCustomer = mysql_fetch_assoc($listCustomer)); $rows = mysql_num_rows($listCustomer); if($rows > 0) { mysql_data_seek($listCustomer, 0); $row_listCustomer = mysql_fetch_assoc($listCustomer); } ?> </select> </td> </tr> <tr> <td width="200" height="25"><div align="right"> <h2>Quoted to:</h2> </div></td> <td><input name="quote_to" type="text" class="widebox" id="quote_to" maxlength="50" /></td> </tr> <tr> <td width="200" height="25"><div align="right"> <h2>Email to:</h2> </div></td> <td><input name="email_to" type="text" class="widebox" id="email_to" /></td> </tr> Quote Link to comment Share on other sites More sharing options...
webster08 Posted February 23, 2009 Share Posted February 23, 2009 if it is only, like a small amount of data that you would need to access; you could use php to dynamically create a javascript array and then create a javascript function to insert data from the array into your text fields accordingly. otherwise; if your accessing a pile of data, at one time; i would skip the array idea and go straight for ajax. Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted February 23, 2009 Share Posted February 23, 2009 In case you haven't seen it there is a script in the FAQ/Code Snippet Repository http://www.phpfreaks.com/forums/index.php/topic,155984.0.html maybe it will be of use to you Quote Link to comment Share on other sites More sharing options...
Alith7 Posted February 23, 2009 Author Share Posted February 23, 2009 I think that might handle it DJ Kat. thank you! I'll try it later today. I don't know much about Ajax, so I need to check and make sure it will work on my server. Quote Link to comment Share on other sites More sharing options...
Alith7 Posted February 23, 2009 Author Share Posted February 23, 2009 moved the question tot he AJAX forum. I'm having problems getting the script to work, though it seems like it will do what I want. thanks for the help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.