I am new to php and cannot figure out what is wrong with this php tag, gives me a parser error, i know there is a quote that i have to add or escape a quote but i cannot get it where to do that <?php echo "<a href=\"index.php?pageid=".$page_id. "&pagename=".$page_name. title=\" .$page_name. "\" class=\"navText\">".$page_name."</a>";?> Code (markup): anyhelp will be appreciated.
sorry some how i created multiple posts was not intending to do that. If moderators can close the other two that got created in error,
<?php echo "<a href=\"index.php?pageid=".$page_id."&pagename=".$page_name."\" title=\"".$page_name. "\" class=\"navText\">".$page_name."</a>";?> PHP: try this.
Instead of putting in all of those backslashes, use single quotes on the outside. <?php echo '<a href="index.php?pageid='.$page_id.'&pagename='.$page_name.'" title="' .$page_name. '" class="navText">'.$page_name.'</a>'; ?> PHP: See how much cleaner that looks?
Almost as clean as using sprintf. <?php echo sprintf('<a href="index.php?pageid=%1$s&pagename=%2$s" title="%2$s" class="navText">%2$s</a>', $page_id, $page_name); ?> PHP:
hmm sprintf seems pretty clean too, can i add more parameters or variables and print them as %3$s etc