vendredi 31 juillet 2015

Assign value to Checkbox and Select fields

I'm having a small issue and not sure how to proceed . I have a modify item page where i want all the values for the item to be preselected based on its specifications in the db .

For the text input boxes , it was simple . i just used :

value = "itemno"

However for the select and checkbox - i have no idea what to do .

<select name="day">

        <option disabled selected>Day</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>

</select>

<input name="type" type="radio" value="box">

<input name="type" type="radio" value="square">

let's say the values for that item from the db are :

type : square day : 5

How can i populate the form for these values ?

I tried :

 <select name="day" value="5">

but it does not work .

For the checkbox - i have no idea either . Any help would be greatly appreciated . Thank you




Aucun commentaire:

Enregistrer un commentaire