Ask your own question, for FREE!
Computer Science 6 Online
OpenStudy (idealist10):

What does action attribute mean in html5?

OpenStudy (idealist10):

<form action="action_page.php"> I know that the action attribute defines the action to be performed when the form is submitted. But how do I create this web page action_page.php?

OpenStudy (idealist10):

@e.mccormick

OpenStudy (anonymous):

Once the user submits the form the browser sends an HTTP request (POST or GET request, depends on the 'method' attribute of the form) containing the form data to the destination described by the 'action' attribute. This request results in navigation to the destination page. So just like other destination attributes ('href' of <a> or 'src' of <img> etc.) you can use either an absolute URL like ` http://www.website.com/foo/bar/target.php ` or a relative URL like `target.php` for the 'action' attribute. Relative URL's will be resolved with respect to the current location, so if your <form> is at ` http://yourwebsite.com/dir/form.php ` then for `action="target.php"` it will send the request to ` http://yourwebsite.com/dir/target.php ` Now you just have to make sure that there is a page waiting at the destination to handle the form submission. Notice that in php you can access the data of the submitted form using $_GET, $_POST and $_REQUEST superglobals: http://www.tutorialspoint.com/php/php_get_post.htm Here is a small example: http://php.net/manual/en/tutorial.forms.php Notice the second file is at same location as the form file and is called `action.php`.

OpenStudy (idealist10):

Thanks!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!