PHP + form select options -


I have a selection that looks like this, it has been written in HTML and submitted through any php Not done,

  & lt; Select name = "status" & gt; & Lt; Option value = "left" & gt; Left & lt; / Options & gt; & Lt; Option value = "true" & gt; Right & lt; / Options & gt; & Lt; Option value = "center" & gt; Center & lt; / Options & gt; & Lt; / Select & gt;  

The value is sent to the database and later it is returned from the database as a variable in the form of $ v ['position'] , And this is my basic form how can I match which varibale default selection?

try this

   gt; & Lt; Option value = "center" & lt ;? Php echo $ v ['position'] == 'center'? 'Selected =' selected "'?:' '& Gt; & Gt; Center & lt; / Option & gt; & Lt; / Select & gt;  

Comments