[img tag] [do while] My code cannot run correctly
As far as the line that echoes out the img tag, you have several problems:
1. If you are going to wrap a string literal in double quotes, then any literal double quotes within it must be escaped with a back-slash.
2. Looks like you want a style attribute for the width?
3. You need a semi-colon that at the end of the line.
Alternatively, just use one type of quote to delimit the string literal and the other for literal quotes within the string:
echo "<img src=\"Image.png\" style=\"width:30px;\">" ;
Or in this case, since you aren't really using any PHP functionality in that string, just exit out of PHP mode (and also fix your comparison logic!):
echo "<img src='Image.png' style='width:30px;'>" ;
(I strongly recommend the use of the full
$ImageNumber = 5 ;
-- $ImageNumber ;
<img src="Image.png" style="width:30px;">"
} while ( $ImageNumber >= 0 );
<?php tag, as short_open_tags may not always be enabled, and it avoids conflict with "<?xml" tags.)
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in
Users Browsing this Thread
There are currently 1 users browsing this thread.
(0 members and 1 guests)