dgnzcn Posted August 12, 2010 Share Posted August 12, 2010 I have this link code : echo "<a href=pop.php?git=urun&popu&id=".$row_Rec1['id'].">".$bul."</a>"; and I wanna add beetwen this code rel="facebox" help please. Link to comment https://forums.phpfreaks.com/topic/210496-a-simple-coding-help/ Share on other sites More sharing options...
dgnzcn Posted August 12, 2010 Author Share Posted August 12, 2010 I try this but not working echo "<a href=pop.php?git=urun&popu&id=".$row_Rec1['id']."rel=\"facebox\">".$bul."</a>"; Link to comment https://forums.phpfreaks.com/topic/210496-a-simple-coding-help/#findComment-1098320 Share on other sites More sharing options...
JasonLewis Posted August 12, 2010 Share Posted August 12, 2010 How is it not working? Add a space between the double quote and rel, and also place escaped double quotes around the href, like you've done with rel. Link to comment https://forums.phpfreaks.com/topic/210496-a-simple-coding-help/#findComment-1098337 Share on other sites More sharing options...
kenrbnsn Posted August 12, 2010 Share Posted August 12, 2010 Change the double quotes around your main string to single quotes: <?php echo '<a href="pop.php?git=urun&popu&id=' . $row_Rec1['id'] . '" rel="facebox">' . $bul . '</a>'; ?> Ken Link to comment https://forums.phpfreaks.com/topic/210496-a-simple-coding-help/#findComment-1098361 Share on other sites More sharing options...
freeloader Posted August 12, 2010 Share Posted August 12, 2010 @ kenrbnsn You forgot to place '&' in front of 'rel'. echo '<a href=pop.php?git=urun&popu=&id='.$row_Rec1['id'].'&rel=facebox>'.$bul.'</a>'; This should work I think. Link to comment https://forums.phpfreaks.com/topic/210496-a-simple-coding-help/#findComment-1098501 Share on other sites More sharing options...
kenrbnsn Posted August 13, 2010 Share Posted August 13, 2010 No, "rel" is an attribute of the <a> tag, it's not part of the URL. The way I interpreted the question, the OP wanted to put the string rel="facebook" in the <a> tag. Ken Link to comment https://forums.phpfreaks.com/topic/210496-a-simple-coding-help/#findComment-1098736 Share on other sites More sharing options...
jcbones Posted August 13, 2010 Share Posted August 13, 2010 Ken is correct. facebox is a javascript function that works like lightbox. Link to comment https://forums.phpfreaks.com/topic/210496-a-simple-coding-help/#findComment-1098739 Share on other sites More sharing options...
isedeasy Posted August 13, 2010 Share Posted August 13, 2010 Ken is correct. facebox is a javascript function that works like lightbox. It's not a javascript function but I know what you mean I would write it as follows <?php echo "<a href=\"pop.php?git=urun&popu&id={$row_Rec1['id']}\" rel=\"facebox\">{$bul}</a>"; ?> Link to comment https://forums.phpfreaks.com/topic/210496-a-simple-coding-help/#findComment-1098815 Share on other sites More sharing options...
kenrbnsn Posted August 13, 2010 Share Posted August 13, 2010 If you're going to use double quotes around the string, us single quotes inside the string so you don't clutter up the string with escaped double quotes. Which is easier on the eye, your way: <?php echo "<a href=\"pop.php?git=urun&popu&id={$row_Rec1['id']}\" rel=\"facebox\">{$bul}</a>"; ?> or <?php echo "<a href='pop.php?git=urun&popu&id={$row_Rec1['id']}' rel='facebox'>$bul</a>"; ?> Ken Link to comment https://forums.phpfreaks.com/topic/210496-a-simple-coding-help/#findComment-1098857 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.