PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am trying to create a form where the user can update a full row from a MySql db.
I want text areas and select lists to show the correct value from the database.
I am trying to do this by using value="'.$row['*****'].'"
This works on the input field but not on the select field, when the page loads it shows the top entry in the list. Can anyone explain what i am doing wrong?
They don't need an array. Why would someone select Mr and Mrs? Also, a select doesn't have a value, the options do. If you need to show the current value then you do it with the selected property of the option tag, something like this:
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Just a question regarding the code you wrote, could that also be used where a visitor had to select an option on a form? I normally set the 'name' as an array( <select name="selection[]"> ). It works but i understand what you mean about the multiple selections. So my select menu would look like this :
Yes. You only need an array if you use <select multiple ...> in which case you must use an array or you will only get the last selection.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.