0
I currently have a selection field where there are several options and only one that the user chose, only I wanted to search the one that he automatically chose by the database. I use the code:
<option <?php if ($company == 1 ) echo 'selected' ; ?>value="1">Apple</option>
Just that I have to put all the options. So I would like you to automatically select the option chosen without needing by all with selected
, it is possible?
It’s not very clear, but if
$company
value 1, means the user selectedApple
, correct? And you want to do something similar with the other options without having to write this PHP code?– Woss
Yes, I wanted to do from select * from, selecting the options, only here comes the fucked part, besides showing the options wanted q was shown which one is selected, understood?
– Carlos Gomes
It is not yet very clear. Are these options saved in the database? If yes, have how to put the code you do the select and displays in HTML?
– Woss
let’s wait for more user info
– user60252