html - php echo within an echo for a checkbox -


i'm trying use checkboxes display , update records in mysql database. want change value of checkbox based on whether it's checked or unchecked. i'm getting error:

parse error: syntax error, unexpected t_encapsed_and_whitespace, expecting t_string or t_variable or t_num_string

here's line of code that's throwing error:

echo"<input type='checkbox' name='pljan' {if (isset($_post['pljan'])) print 'value='checked''} $row->pljan /> january ";

is there better way me saving update database 'checked' if box checked, , blank if box unchecked?

thanks in advance halps.

echo"<input type='checkbox' name='pljan' {if (isset($_post['pljan'])) print 'value='checked''} $row->pljan /> january "; 

should be

echo"<input type='checkbox' name='pljan'";  if (isset($_post['pljan'])) { echo " value='checked'"; }  echo $row->pljan . "/> january "; 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -