arunpatal Posted January 1, 2013 Share Posted January 1, 2013 Hi, Happy new to everyone I want to hyperlink a div It works like this <div id="right_content" onclick="document.location.href='list_topic.php?id=<?php echo $row_sub_cat['subid']; ?>';" style="cursor:pointer;cursor:hand"> </div> but when i want to use it with if else statement like this <?php if (isset($row_sub_cat['subid'])){ echo '<div id="right_content" onclick="document.location.href='list_topic.php?id='.$row_sub_cat['subid'].'';" style="cursor:pointer;cursor:hand"> </div>'; } else { echo '<div id="right_td_content_for_list">there is no subcategory</div>'; } ?> It don't work Any Help ???? Quote Link to comment https://forums.phpfreaks.com/topic/272569-div-to-hyperlink/ Share on other sites More sharing options...
Jessica Posted January 1, 2013 Share Posted January 1, 2013 You need to escape the single quotes within the string Quote Link to comment https://forums.phpfreaks.com/topic/272569-div-to-hyperlink/#findComment-1402524 Share on other sites More sharing options...
arunpatal Posted January 1, 2013 Author Share Posted January 1, 2013 You need to escape the single quotes within the string Thanks it works Quote Link to comment https://forums.phpfreaks.com/topic/272569-div-to-hyperlink/#findComment-1402544 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.