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 “?”.
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.
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!
Marion
To put it clearly, just saying ? means sending no getdata to whatever the default page is at the current directory…
action=“?”
is functionally identical to saying:
action=“./”
basically if defaultpage was a variable…
action=“defaultpage?”
where defaultpage could be any one of:
index.html
index.htm
index.php
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: