lundi 12 février 2018

Option selected is equal to database value

I'm trying to build a form to edit my content and have a select box. How do i make it so the rating score that was inputted into the database through the option value(1-5) will be the selected option when the user enters the edit form?

edit code:

                
                <select class="form-control edit-form" name="ratings">
                    <option value="1">Very Poor</option>
                    <option value="2">Poor</option>
                    <option value="3">Fair</option>
                    <option value="4">Good</option>
                    <option value="5">Very Good/option>
                </select>

the old rating score(1-5) can be reached through this:

$reviews->rating

How do i make it so that the old rating score shows as the selected option value, when they user enters the form?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire