I want html form submit on self page, how to use action
atribute
<form action="">
or
<form action="#">
or
<form action="here write addres this page">
or just simple not use action
atribute ?
what is much better way ?
I want html form submit on self page, how to use action
atribute
<form action="">
or
<form action="#">
or
<form action="here write addres this page">
or just simple not use action
atribute ?
what is much better way ?
Use ? ,
it will help you to stay on the same page
If you are submitting a form using php be sure to use:
for security.
try this same form action page url, it will direct the same page
form action="/cgi-bin/html5.cgi" method="get"
You can leave action attribute blank. The form will automatically submit itself in the same page.
UPDATE #1
According to the w3c specification, action attribute must be non-empty valid url in general. There is also an explanation for some situations that action attribute may be leave empty.
So they both still valid and works:
UPDATE #2
If you are sure about your audience is using html5 browsers then you can even omit action attribute:
You can do it using the same page on the action attribute:
action='<yourpage>'
In 2013, with all html5 stuff, you can just ommit the 'action' attribute to self-submit a form
Actually, the Form Submission subsection of the current HTML5 draft does not allow action="" (empty attribute). It is against the spec.
From this other Stackoverflow answer