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 ?
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 ?
Share Improve this question edited Jan 4, 2014 at 9:19 Karuppiah RK 3,9649 gold badges41 silver badges85 bronze badges asked Jan 4, 2014 at 9:15 bobbybackblechbobbybackblech 1,8866 gold badges20 silver badges22 bronze badges 6 | Show 1 more comment1 Answer
Reset to default 19You can use the type="submit"
like property of button
<button type="submit" name="<?php echo $name; ?>">Submit</button>
<input>
" - you know wrong. Buttons submit forms. – Quentin Commented Jan 4, 2014 at 9:18