Php 如何创建直接指向mysql查询结果的url的按钮
我已成功显示来自mysql查询的数据。但有一个url连接到存储在mysql数据库中的文件。但我需要将这个基于文本的url更改为一个按钮。这是我的剧本:Php 如何创建直接指向mysql查询结果的url的按钮,php,button,Php,Button,我已成功显示来自mysql查询的数据。但有一个url连接到存储在mysql数据库中的文件。但我需要将这个基于文本的url更改为一个按钮。这是我的剧本: <td align="center"><a href='<?php echo $res['url_new_edition'] ?>'>New Edition</a></td> 现在,我想把“新版”文本当然变成一个链接/url,变成一个按钮。我已经尝试添加'class=button
<td align="center"><a href='<?php echo $res['url_new_edition'] ?>'>New Edition</a></td>
现在,我想把“新版”文本当然变成一个链接/url,变成一个按钮。我已经尝试添加'class=button',type='button'等,但没有任何效果。试试这个
<input type="button" onclick="window.location.href='http://google.com'; return false;">
就你而言
<input type="button" onclick="window.location.href='<?php echo $res['url_new_edition'] ?>'; return false;">
如果需要按钮,请使用表单而不是href。即使没有JavaScript,一个清晰的解决方案也会是这样的:
<form action="<?php echo $res['url_new_edition']; ?>" method="get">
<input type="submit" value="New Edition" />
</form>