karimali831 Posted December 30, 2010 Share Posted December 30, 2010 Hi If a string exceeds 65 characters then $show_all will return, what I want to achieve is to return the whole string when I click on the hyperlink (more...) can someone help me do this please? I do not want it to show the whole string and substr(getinput($ds['desc']),0, 65).$show_all if(strlen($ds['desc'] < 65)) $show_all = '<a href="#">(more...)"</a>'; echo substr(getinput($ds['desc']),0, 65).$show_all; thanks! Link to comment https://forums.phpfreaks.com/topic/223012-strlen-and-strlen/ Share on other sites More sharing options...
Andy-H Posted December 30, 2010 Share Posted December 30, 2010 if(strlen($ds['desc'] < 65)) $show_all = '<a href="?show=all">(more...)</a>'; if ( !isset($_GET['show']) ) { echo substr(getinput($ds['desc']),0, 65).$show_all; } else { echo getinput($ds['desc']); } Link to comment https://forums.phpfreaks.com/topic/223012-strlen-and-strlen/#findComment-1153031 Share on other sites More sharing options...
karimali831 Posted January 2, 2011 Author Share Posted January 2, 2011 thanks this will work but won't be any good for what I need it for. I am using a while loop to generate multiple rows from a table, so I need something like jquery, you click on "show all" and it will show you full text without pageload? Link to comment https://forums.phpfreaks.com/topic/223012-strlen-and-strlen/#findComment-1153869 Share on other sites More sharing options...
BlueSkyIS Posted January 2, 2011 Share Posted January 2, 2011 either echo all data to the page and hide it in a hidden DIV, displaying the DIV onclick. or use ajax to retrieve the additional information onclick. Link to comment https://forums.phpfreaks.com/topic/223012-strlen-and-strlen/#findComment-1153870 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.