Jump to content

Clickable buttons within php if statements


lanceox

Recommended Posts

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

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.