doudui1850 2013-10-09 19:13
浏览 17

如何使用PHP将表单信息插入到html按钮

Here's what I'm looking to accomplish. When a user creates a profile they fill out some information with a form. After they submit the form the information is displayed on their profile. One of the form fields is going to be a button that other users can click to do an action. To display the button this is the PHP I currently have:

add_action('kleo_bp_after_profile_name', 'my_profile_button');
function my_profile_button()
{
echo '<a href="#" class="success button radius show-for-small" rel="nofollow">Talk</a>';
}

I need to input the form information into the href="#" spot. Does anyone know a way around this?

Thanks.

  • 写回答

2条回答 默认 最新

  • dongtongjian3127 2013-10-09 19:24
    关注

    Sure, if you have captured that information with a POST variable, named 'redirect' for example, you could use it to generate a button. The problem is that I don't understand very well what you mean with be put into href="#" spot, because buttons don't have that property, so I write you the code to use it on a redirection which is done at clicking the button:

    <input type="button" value="submit" onclick="location.href='<?php echo $_POST["redirect"];?>';">
    

    If you want to use information in a link, which actually have href property use this:

    <a id="link" href="<?php echo $_POST['redirect'];?>">Text of the link</a>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入