Why single quote here?

robertovasquez wrote on Tuesday, July 28, 2015:

type=hidden name=noteid id=noteid value=".attr($noteid).">
I have tested this code and works. If I add single quote after value=’" it also works.

type=hidden name=noteid id=noteid value=’".attr($noteid)."’>
What is the best way and why?
Advice need it

bradymiller wrote on Wednesday, July 29, 2015:

Hi,

Single quotes is nice in this situation, so if there is more than one word in $noteid, it won’t break the script.

Usually html attributes are always wrapped with a quote (either single or double).

On whether to use since or double, depends on the context. If there is a php echo that is wrapped in double quotes, then more clear to use single quote (and vice versa).

-brady
OpenEMR