简体   繁体   中英

How can I create a HTML button that opens a link in a .php table?

First of all, I have very little programming experience and even less with .php

I'm actually trying to figure out the code that our last programmer left us before he quit his job.

Basically, I have a table with information inside.

The multiple information is useful to create a new string that is a hyperlink.

My variable is the "build-up hyperlink string" called $createdlink .

It's all working well but the links are looking like this :

http://www.fdksmsdkldfkmkdfmhd.com/search/?kldsmnfkjldsfgsdfjgnfsdjkgfjdknkmgfdlkmfgkfdmglkfdmlgfdkl 

It's taking too much place in the table.

My goal is to create HTML buttons inside my table so it's taking less space and it's doing the same job.

Here is what my "working code" looks like

echo '<td class="'.$info->type.'">'.$createdlink.'&nbsp;</td>';

How can I insert a HTML button replacing the $createdlink ?

您需要的是一个锚元素 -至于如何将其设置为按钮样式,您有多个选择,但是获得较小链接的最简单方法是"<a href='$createdlink'>Go</a>"

You can do something like this:

$form = "<form action='$createdlink'>";
$form .= "<input type='submit' value='This is a button link'>";
$form .= "</form>";
echo '<td class="'.$info->type.'">'.$form.'&nbsp;</td>';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM