View Full Version : Submit Method
10-12-2011, 04:53 AM
When you use a form and submit it the URL bar changes to what the submitted values are. So can anyone explain how to use this?
10-12-2011, 05:15 AM
When you use a form and submit it the URL bar changes to what the submitted values are.
Not necessarily. If you use
<form action="somepage.php" method="post">
the method=post means the data is sent "behind the scenes".
Only if you use method=get (or omit the method, in which case it defaults to get) will you see the form field values in the QUERY STRING. The query string is everything after the question mark in the URL.
Note that *ONLY* form fields that are NAMED will be sent, whether by get or by post.
Posted data can't be used by HTML pages. It must be used by server-side code that can receive it properly.
var querystring = location.search; // gives everything from ? onward
var querystring = location.search.substring(1); // omits the ?
So, then, it is simply a matter of PARSING the query string. And this has been discussed many times in this forum. It's almost identical to parsing document.cookie excepting that the separator character is & instead of ; and there is no space after each &.
10-12-2011, 10:51 PM
so i can refer to it by using this var querystring?
10-12-2011, 11:15 PM
Yes, but now how do you find out what it *MEANS*?
Did you follow my point about the parallel to cookies?
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.