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

 

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.