I need to add a "alt" to a image but can't?
Posted 25 May 2006 - 03:28 PM
Why won't this work?
// Generate random number from 1-10
$imgnum = rand(1, 10);
// Set image path and file name with generated number
$imgpath = "images/TopBanner" . $imgnum . ".jpg";
// Display image
echo ("<img src=\"$imgpath\"alt="Welcome to"/>");
I can't validate my page because the banner image has no alt and no closing tag but I get a error when I try the above. Here is my include file.
Posted 25 May 2006 - 03:45 PM
echo ("<img src=\"$imgpath\"alt="Welcome to"/>");To:
echo "<img src='". $imgpath. "' alt='Welcome to'/>";[/quote]
Thanks it worked but why? If you don't mind or point me to a page in the Manual.
Posted 25 May 2006 - 04:47 PM
using ' has as similar effect
echo "that is the question";
Posted 25 May 2006 - 07:11 PM
echo "name = "blah" value="blah"";
you have to use escape characters to do that:
echo "name = \"blah\" value = \"blah\"";
or else use single quotes like shown above:
echo "name = 'blah' value = 'blah'";
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users