Filling Form fields - data cuts off at quotation marks

I am trying to create a content management tool for a PHP/mySql database of articles and I’m getting very strange results when I mix PHP with HTML - I understand the reason - the HTML forms are reading the PHP tags.

When I try to write (with echo) back into the article submit form the characters either cut off at a quotation mark - or write the rest of the content outside the form input boxes.

For example, this works for entry but I have removed the closing input tags because otherwise they get written to the content:

echo '<input name="sectionid" type="hidden" value="'.$article['id'].'</input>';
echo '<option name="section_id" value='.$article['section_id'].'</option></td><td>';    

When writing content to my page that will assign article order I have to use the above structure - it works with data that begins with an HTML tag (like <p>) but if I remove the tag from the start of the data the corresponding form field is blank.

Is there a tutorial somewhere showing a working syntax?

Thanks
Charles

The first line should be

echo '<input name="sectionid" type="hidden" value="'.$article['id'].'" />';