SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: form action="?"

  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Location
    Plano, TX (north of Dallas)
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question form action="?"

    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,
    Marion

  2. #2
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,752
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    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.
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  3. #3
    SitePoint Member
    Join Date
    Jan 2012
    Location
    Plano, TX (north of Dallas)
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  4. #4
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    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:

    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.

  5. #5
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by deathshadow60 View Post
    To put it clearly, just saying ? means sending no getdata to whatever the default page is at the current directory...
    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/?".
    Simon Pieters


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •