php - getting error when trying to save user Select data -


i trying save state user select after 'post' form action runs on same page, keep getting unexpected t_is_equal, expecting '}' error. missing?

i have following code:

<select style='width:50px; float:left; position:relative; left:-160px; top:2px; border-radius:3px; ' project='statelist' class='statelist' name='statelist'>  $state = array( 'az','al','ak','ar', 'ca','co', 'ct','de','dc','fl', 'ga', 'hi','id','il', 'in','ia','ks','ky','la','me','mt','nv','nh','nj','nm','ny','nc', 'nd','oh', 'ok', 'or', 'md','ma', 'mi','mn','ms', 'mo','pa', 'ri', 'sc','sd','tn', 'tx', 'ut', 'vt', 'va','wa', 'wv','wi','wy');  foreach($state $name) { $selected = ''; if {$_post['statelist'] == $name}{ $selected = 'selected';} echo '<option value="'.$name.'"'.$selected.">{$name}</option>\n"; } </select> 

you got bracket happy.

if {$_post['statelist'] == $name}{ 

should be

if ($_post['statelist'] == $name){ 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -