spartin20 Posted March 9, 2008 Share Posted March 9, 2008 Hello, I'm got a bit of a weird one here. I have a hyperlink on my page which I want to diasble (ie: be not clickable") when a value returned from the MySql database is more than 60. The scenario is that I have a tutorial system, and when my students get over 60% in a module, it doesn't let them back in to access it again. The modules are all displayed as hyperlinks on the index page and I want to make them unclickable if they get over 60%. I'm grand getting the values from the MySql database, but just need to know how to make the hyperlink links unclickable in php using their ID. I tried making the <a href = "#"> but that still makes it clickable!! Thanks in advance. Steve Quote Link to comment https://forums.phpfreaks.com/topic/95199-disabling-a-hyperlink/ Share on other sites More sharing options...
trq Posted March 9, 2008 Share Posted March 9, 2008 Hyper links are hyper links. You'll need to make the text plain text instead of a link. Quote Link to comment https://forums.phpfreaks.com/topic/95199-disabling-a-hyperlink/#findComment-487607 Share on other sites More sharing options...
spartin20 Posted March 9, 2008 Author Share Posted March 9, 2008 Is there a way to do this dynamically, like for eg, remove the <A href> tags???? Quote Link to comment https://forums.phpfreaks.com/topic/95199-disabling-a-hyperlink/#findComment-487617 Share on other sites More sharing options...
Xajel Posted March 9, 2008 Share Posted March 9, 2008 create a javascript function that do nothing <script> function nothing() { // nothing here } </script> and replace the hyperlink with javascript:nothing(); <a href="javascript:nothing();">link</a> this will make the link, clickable and saves the links style too, but nothing will happen when clicked Quote Link to comment https://forums.phpfreaks.com/topic/95199-disabling-a-hyperlink/#findComment-487619 Share on other sites More sharing options...
spartin20 Posted March 9, 2008 Author Share Posted March 9, 2008 sorry I dont mean to be a pain but is there any way to make it not clickable, ie: appears just like plain text Quote Link to comment https://forums.phpfreaks.com/topic/95199-disabling-a-hyperlink/#findComment-487625 Share on other sites More sharing options...
trq Posted March 9, 2008 Share Posted March 9, 2008 sorry I dont mean to be a pain but is there any way to make it not clickable, ie: appears just like plain text Yes, just make it plain text. Post the relevent code if you want more help. Quote Link to comment https://forums.phpfreaks.com/topic/95199-disabling-a-hyperlink/#findComment-487627 Share on other sites More sharing options...
Xajel Posted March 9, 2008 Share Posted March 9, 2008 will this will make you go for removing the <a href=""> + </a> from the link, here you may want to go for regex unless the links there are printed in php, in the later case it's just an if condition if ($mark>=60) { echo "normal text"; }else{ echo "<a href=\"hyperlink\">link text</a>"; } about that regex, I know some basic but I think the regex forum will be much helper but as thorpe said, post the code if you want more specific help Quote Link to comment https://forums.phpfreaks.com/topic/95199-disabling-a-hyperlink/#findComment-487630 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.