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. Quote 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>"; Quote 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. Quote 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 Quote 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. Quote 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 Quote 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. Quote 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>"; ?> Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/210496-a-simple-coding-help/#findComment-1098857 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.