简体   繁体   中英

Use a submit <button> instead of <input> button

i want to submit a form with <button> instead of <input> . I know a <button> cant handle the form like a submit <input> and i have to use the onclick method.

I tried several things but it doesn't work

<button name="<?php echo $name; ?>" onclick="document.<?php echo $this->action; ?>.submit()"> ... ( Action URL of the form )
<button name="<?php echo $name; ?>" onclick="document.iso<?php echo rand(); ?>.submit()">... ( name of the form )
<button name="<?php echo $name; ?>" onclick="window.location.href='<?php echo $this->action; ?>'">... ( Action url of the form )

Does someone know an answer ?

您可以使用按钮type="submit" like属性

<button type="submit" name="<?php echo $name; ?>">Submit</button>

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