I'm new to PHP but was wondering how this can be done.
I want to have submit an HTML form to another PHP page, but i dont want to use the ugly button. I want to use a link.
The thing is, i see many solutions out there that uses Java Script/Jquery etc to solve this, Does any one know how to do this with PHP code and HTML only?
Either use a <input type="submit">
and style it like a link with css, or create a Link with onclick:
<a href="#" onclick="document.forms['name_of_your_form'].submit();">Lol Rofl</a>
If you want to make sure it works when JS is disabled, add something like this:
<noscript>
<input type="submit" ... />
</noscript>
This will show the button on computers where JS is disabled, the link above will still be shown. A workaround is to hide the link with CSS and then show it with JS..
You can do this way:
<a href="#" onclick="document.forms['form_name'].submit();">Submit</a>
That will submit the form to whatever url set in the action
attribute of the form
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With