Html 如何更改按钮的href?

Html 如何更改按钮的href?,html,button,input,href,Html,Button,Input,Href,我有一个建议: <input type="submit" class="inputlogin submit" name="register" style="margin-top: 5px;" value="Maak mijn account en log in!"> 然后它进入寄存器/寄存器。我希望它转到/me,我如何才能做到这一点?输入所指的页面是在的action属性中定义的,而不是本身 <form action="/me" method="get"> Mus

我有一个建议:

<input type="submit" class="inputlogin submit" name="register" style="margin-top: 5px;" value="Maak mijn account en log in!">


然后它进入寄存器/寄存器。我希望它转到/me,我如何才能做到这一点?

输入所指的页面是在
的action属性中定义的,而不是
本身

<form action="/me" method="get">


Musa,欢迎来到堆栈溢出

“提交”按钮完全按照其名称执行:它提交表单。现在,表单提交到的位置,不是提交按钮的属性,而是表单的属性


您会发现,提交按钮是
的一部分构造。通过更改表单的action属性,您可以将其指向另一个URL,例如“/me”

您的代码必须如下所示:

<form action="/me" method="post">
    <input type="submit" class="inputlogin submit" name="register" style="margin-top: 5px;" value="Maak mijn account en log in!">
</form>


我现在真的很困惑。因此,我有
,我需要改为:
也许我需要在前面说这个,但这是一张登记表,所以需要检查是否所有内容都已填写,并且需要进入数据库。

另一种方法是:

<input type="button" class="inputlogin submit" style="margin-top: 5px;" value="Maak mijn account en log in!" onclick="parent.location='/me'">


这将使用onclick,并且将在没有表单的情况下工作。请记住,它不会发布表单,因此,我现在看到我已经有了正确的代码,但它会转到/register/me。。我真的很惭愧…


<div class="text" style="font-weight:bold;padding:10px;"><?php if(isset($template->form->error)) { echo '<div class="error-messages-holder"><ul><li><p class="error-message">'.$template->form->error.'</p></li></ul></div>'; } ?>
        <form method="post" action="{url}/me" autocomplete="off">
          <label for="index_rusername">Neem een unieke nickname:</label><br />
          <input type="text" placeholder=" Jouw gebruikersnaam " class="inputlogin" name="reg_username"><br />
          <label for="index_rpassword">Kies een sterk wachtwoord:</label><br />
          <input type="password" placeholder=" Jouw wachtwoord " class="inputlogin" name="reg_password"><br />
          <label for="index_rconpassword">Typ je wachtwoord over:</label><br />
          <input type="password" placeholder=" Jouw wachtwoord " class="inputlogin"  name="reg_rep_password"><br />
          <label for="index_remail">Jouw email adres:</label><br />
          <input type="text" placeholder=" Jouw e-mail adres " class="inputlogin"  name="reg_email"><br />
          <input type="submit" class="inputlogin submit" name="register" style="margin-top: 5px;" value="Maak mijn account en log in!">
        </form>
   </div>
  </div>
印楝树昵称:

基斯·伊恩·斯特克·瓦赫特伍德:

典型的杰瓦赫特沃德:超过:

电子邮件地址:


我现在有这个密码了。但如果我按下按钮,它不会在数据库中注册,因此所有配置的内容都不会出现在“用户”表中。

将表单中的操作值更改为/me(我假设您已经对表单进行了编码)@KunjanThadani,在那里我可以找到操作值?显示足够的代码以再现问题,并解释问题所在。“去登记”并没有真正说明发生了什么。至少,您需要包含一个
表单
元素,并解释提交时会发生什么。否。您正在混合表单和输入标记。请检查我的答案,以便填写表格。最好看看html的基础知识。这不是答案。要澄清您的问题,请编辑您的问题。