...

View Full Version : too many quotes



footballer27
02-26-2012, 02:14 AM
hey all, I don't know how to fix this



echo "<div id='trackNav' style='float:left;'><a href='../'>Home</a> > <a href='javascript: displayCategory(' ". $category ." ', ' ');'>" . $category . "</a> > <a href='javascript: displayCategory(' " . $subCategory . " ', ' ');'>" . $subCategory . "</a></div>";


is there an escape key for this type of situation
basically, the quotes are cancelling themselves out when I don't want them too. I know this doesn't really matter which language your using, but since I'm using php I'm posting it here. thanks for any help

mlseim
02-26-2012, 04:21 AM
See what happens if you do this ...

echo "<div id='trackNav' style='float:left;'><a href='../'>Home</a> > <a href='javascript: displayCategory('$category', ' ');'>$category</a> > <a href='javascript: displayCategory('$subCategory', ' ');'>$subCategory</a></div>";

tangoforce
02-26-2012, 04:34 PM
Use \" for the quotes inside the string. That will escape them without screwing up your html quotes.

Once printed to the page you will just see "

The quotes link in my signature might help you out a bit more.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum