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...)

4
  • 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). Commented Feb 14, 2014 at 12:23
  • Stop using notepad when coding, guys Commented Feb 14, 2014 at 12:25
  • my file shows nothing - Time to enable error reporting - It will make your life a whole lot easier. Commented Feb 14, 2014 at 12:26
  • can you recommend the program good for PHP coding? Commented Feb 15, 2014 at 4:48

5 Answers 5

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>';
  ...^
Sign up to request clarification or add additional context in comments.

Comments

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>';

Comments

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 '.

Comments

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.

Comments

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>";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.