my4skcg — 2012-03-17T14:31:06-04:00 — #1
I need help in understanding what this does; specifically the "?". I'm searching the internet for an explanation, but it doesn't seem to be documented anywhere. I can find information on a blank form action (form action = ""), and on form action = a url or php file, but not "?".
Thank you for you help,
ryanreese — 2012-03-17T15:41:45-04:00 — #2
Hi my4skcg, welcome to Sitepoint :).
Whatever is inside the quotes is what URL the browser will go to upon submit (your ? example would make it go to sitehere.com/form.php?). The ? at the end of that URL is just what'll get added on (I assumed in my example that the URL gone to is sitehere.com/form.php and when you click submit, it'll just add on ?, if that makes sense) I'm wondering where you even saw this though?
Normally people send the information to a PHP page (or some other language) for work. Depends on what the form is.
my4skcg — 2012-03-18T13:17:34-04:00 — #3
I saw this in a Sitepoint book, Build Your Own Database Driven Web Site Using PHP & MySQL by Kevin Yank. I went back in the book and found where it is first used and the explanation. It's on page 132 in the book; "...the URL used to display the form in the example will feature a query string, and setting the action to ? strips that query string off the URL."
I was further into the book and coding the examples, studying the code to make sure I understood it all and did not remember reading this.
Thanks for you help! And for the welcome to Sitepoint! Great books, great prices on books, and a great website!
system — 2012-03-18T15:15:19-04:00 — #4
To put it clearly, just saying ? means sending no getdata to whatever the default page is at the current directory...
is functionally identical to saying:
basically if defaultpage was a variable...
where defaultpage could be any one of:
or whatever else the server it's running on is set up to check as the default page for /
In Apache the list of files to be called as the index is set via the directoryIndex variable, which you can change or customize with a .htaccess file... and these days typically starts out set to this:
DirectoryIndex index.html index.htm default.htm index.php index.php3 index.phtml index.php5 index.shtml
works like font-family does in CSS... if the first one is found, it's used, if not try the next one and lather-rinse repeat until one is found.
zcorpan — 2012-03-19T03:54:11-04:00 — #5
No. If the current page is "http://example.org/foo/bar" then resolving "?" against it will result in "http://example.org/foo/bar?" and not "http://example.org/foo/?".