lanceox Posted March 6, 2011 Share Posted March 6, 2011 Hi guys, thanks in advance. What im trying to do is present clickable linked buttons depending on results of the if statements. I want to replace the standard href links into the buttons if possible? Here is some of the code. <?php if ($DetectionPercent <= 30){ // beg echo '<li><a href="http://www.google.com"> View Personalised Detection Content</a>'; } elseif ($DetectionPercent > 30 && $DetectionPercent <= 60){ //int echo '<li><a href="http://www.youtube.com"> View Personalised Detection Content</a>'; } else //exp { echo '<li><a href="http://www.facebook.com">View Personalised Detection Content</a>'; } ?><HR> Been looking into it a while and just can seem to find anyway to do this. Thanks Lance Link to comment https://forums.phpfreaks.com/topic/229756-clickable-buttons-within-php-if-statements/ Share on other sites More sharing options...
flolam Posted March 6, 2011 Share Posted March 6, 2011 Why do you want to use buttons? If you really need to use them, you would have to wrap a <button> tag in a <form> tag for each link: <form action="link target 1" method="get"> <button type="button" value="link text 1" /> </form> <form action="link target 2" method="get"> <button type="button" value="link text 2" /> </form> However, I don't see a reason to do this. Instead you should use CSS to style the links according to your wishes and make them look like buttons. Link to comment https://forums.phpfreaks.com/topic/229756-clickable-buttons-within-php-if-statements/#findComment-1183622 Share on other sites More sharing options...
lanceox Posted March 6, 2011 Author Share Posted March 6, 2011 Hey, thanks for the advice. I looked into css and it works just how i wanted it to. Thanks. Link to comment https://forums.phpfreaks.com/topic/229756-clickable-buttons-within-php-if-statements/#findComment-1183707 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.