0
   echo "<input type="checkbox" name="h" id="cbox3" /><label for="cbox3"><img align="middle" src="/upload/JPNP033.JPG" /> </label>";

I am making the PHP file to show image with 'checkbox'. I want each image with one's own 'checkbox'.

I added this echo sentence in my php file but after i added this command, my file shows nothing(it doesn't work...)

rayjang
  • 140
  • 11
  • Since you are using the same operator (`"`) to open the html `type` attribute, you are effectively ending the string there. Anything after that becomes a syntax error hence your file showing nothing (fatal error). – SamV Feb 14 '14 at 12:23
  • Stop using notepad when coding, guys – Royal Bg Feb 14 '14 at 12:25
  • `my file shows nothing` - Time to [enable error reporting](http://stackoverflow.com/a/6575502/1438393) - It will make your life a whole lot easier. – Amal Murali Feb 14 '14 at 12:26
  • can you recommend the program good for PHP coding? – rayjang Feb 15 '14 at 04:48

5 Answers5

3

Try this, use ' instead of " quotes

echo '<input type="checkbox" name="h" id="cbox3" /><label for="cbox3"><img align="middle" src="/upload/JPNP033.JPG" /> </label>';
  ...^
Krish R
  • 22,583
  • 7
  • 50
  • 59
0

Use single quotes ('), otherwise the double quotes (") will interfer with each other, causing the data not the be output:

 echo '<input type="checkbox" name="h" id="cbox3" /><label for="cbox3"><img align="middle" src="/upload/JPNP033.JPG" /> </label>';
display-name-is-missing
  • 4,424
  • 5
  • 28
  • 41
0

What you're basically doing is ending your echo by writing " in your HTML. What you should do is write \", this basically makes it so that it ignores the " as PHP.

Also, as suggested, you can change every " (that is HTML) to '.

Daan
  • 2,680
  • 20
  • 39
0

While writing HTML content in echo please remember this. If you are using double quotes " as outer quotes then quotes used in HTML should be single quotes ' and Reversal.

So change you echo syntax according to that.

krishna
  • 4,069
  • 2
  • 29
  • 56
0

Try this, use ' instead of " quotes

echo '<input type="checkbox" name="h" id="cbox3" /><label for="cbox3"><img align="middle" src="/upload/JPNP033.JPG" /> </label>';

but the good practice is

your php code here ?>
<input type="checkbox" name="h" id="cbox3" /><label for="cbox3"><img align="middle" src="/upload/JPNP033.JPG" /> </label>";
Shahbaz
  • 3,433
  • 1
  • 26
  • 43