beginneratphp Posted September 5, 2007 Share Posted September 5, 2007 Hi, I am new here so hello everybody!!! I have a combobox which has different peoples names which are pulled from fields in a database. Can anybody please show me some code that will change the recordset so say for example there were two records in the DB with three bits of data name, number and telephonenumber: John 10 01234567544 Frank 34 07883922332 and somebody selects john from the select box that in the two fields it shows 10 and 0123... and 34, 078839..... if they select frank. Thanks in advance!!! Quote Link to comment https://forums.phpfreaks.com/topic/68117-change-record-when-user-chooses-option-from-listbox/ Share on other sites More sharing options...
lemmin Posted September 5, 2007 Share Posted September 5, 2007 "SELECT field2, field3 FROM table WHERE field1 = " . $_POST['optionname']; Something like that. Quote Link to comment https://forums.phpfreaks.com/topic/68117-change-record-when-user-chooses-option-from-listbox/#findComment-342400 Share on other sites More sharing options...
beginneratphp Posted September 5, 2007 Author Share Posted September 5, 2007 "SELECT field2, field3 FROM table WHERE field1 = " . $_POST['optionname']; Something like that. Sorry where would I put that?? so if textboxes were called rating & telnum and the dbfields called flrating and fltelnum?? Quote Link to comment https://forums.phpfreaks.com/topic/68117-change-record-when-user-chooses-option-from-listbox/#findComment-342414 Share on other sites More sharing options...
lemmin Posted September 5, 2007 Share Posted September 5, 2007 That is an sql query string. I would suggest you do a little research on php and mysql before trying to do this project. Quote Link to comment https://forums.phpfreaks.com/topic/68117-change-record-when-user-chooses-option-from-listbox/#findComment-342415 Share on other sites More sharing options...
beginneratphp Posted September 5, 2007 Author Share Posted September 5, 2007 That doesn't help me very much I have been trying what I found on google and it isn't working. I had $query_conn = "SELECT * FROM person WHERE 'name' = " . $_POST['select']; and it just gives me an error Quote Link to comment https://forums.phpfreaks.com/topic/68117-change-record-when-user-chooses-option-from-listbox/#findComment-342422 Share on other sites More sharing options...
lemmin Posted September 5, 2007 Share Posted September 5, 2007 This should help, then. http://www.php-mysql-tutorial.com/ Quote Link to comment https://forums.phpfreaks.com/topic/68117-change-record-when-user-chooses-option-from-listbox/#findComment-342426 Share on other sites More sharing options...
beginneratphp Posted September 5, 2007 Author Share Posted September 5, 2007 but surely this will only set the correct sql data if the select box is already on the correct name when the page loads?? Quote Link to comment https://forums.phpfreaks.com/topic/68117-change-record-when-user-chooses-option-from-listbox/#findComment-342432 Share on other sites More sharing options...
beginneratphp Posted September 5, 2007 Author Share Posted September 5, 2007 This isn't working for me Quote Link to comment https://forums.phpfreaks.com/topic/68117-change-record-when-user-chooses-option-from-listbox/#findComment-342441 Share on other sites More sharing options...
beginneratphp Posted September 5, 2007 Author Share Posted September 5, 2007 Could somebody just give me an example of some code that will do this? Quote Link to comment https://forums.phpfreaks.com/topic/68117-change-record-when-user-chooses-option-from-listbox/#findComment-342463 Share on other sites More sharing options...
lemmin Posted September 5, 2007 Share Posted September 5, 2007 I searched this forum for "mysql drop down" and found a lot of sample code. Quote Link to comment https://forums.phpfreaks.com/topic/68117-change-record-when-user-chooses-option-from-listbox/#findComment-342469 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.