SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 38 of 38
  1. #26
    SitePoint Zealot
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    185
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Xargo
    I don't see why you find POST and GET variables set messy. The point is that I use MySQL for the content of my sites, my site is only one page: index.php. I always have to use GET variables. And if I use a login form I certainly need to use POST too, so I can't avoid using both at the same time.
    Still your script as you have it only works incidently because using $PHP_SELF actually does not set an action in the form, so the default GET action applies. Try it view the page source in the browser when you have the form loaded, is an action set?

    I would use $_SERVER['PHP_SELF'] correctly, set the hidden page variable and use $_REQUEST to get at the page variable inside the script then.

    PHP Code:
    $page $_GET['page']; 
    if (
    $page == ""

        echo 
    "This is the start page."
    }

    // becomes

    $page $_REQUEST['page']; 
    if (
    $page == ""

        echo 
    "This is the start page."

    --
    lv

  2. #27
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Xargo
    The only GET variable is the page var, defining which page the person visits.
    Yes but you can do that with a nice clean URL without a query string. Personally I like to have meaningful URLs.

    And yes I was talking about individual files. It's a lot more efficient especially if the DB and webserver are on different machines as is frequently the case.

  3. #28
    SitePoint Member
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lvismer
    Still your script as you have it only works incidently because using $PHP_SELF actually does not set an action in the form, so the default GET action applies. Try it view the page source in the browser when you have the form loaded, is an action set?

    I would use $_SERVER['PHP_SELF'] correctly, set the hidden page variable and use $_REQUEST to get at the page variable inside the script then.

    PHP Code:
    $page $_GET['page']; 
    if (
    $page == ""

        echo 
    "This is the start page."
    }

    // becomes

    $page $_REQUEST['page']; 
    if (
    $page == ""

        echo 
    "This is the start page."

    --
    lv
    I knew it filled in nothing as action, but I didn't know it took GET as default action then. Now I get why it works with that variable. I'll change it. Any other thoughts about my script or is it ok now?

    Quote Originally Posted by bokehman
    Yes but you can do that with a nice clean URL without a query string. Personally I like to have meaningful URLs.
    I don't get your point. Nice clean URLs are irritating because you can't have the decent url of the page itself, thus if you refresh you get reset to the first page again, and secondly because people could be able to bookmark or store URLs to different page, not to the main site only. What do you mean with meaningful URLs then, I see an url having a page variable so it's not just the URL of the homepage as more meaningful.

    Quote Originally Posted by bokehman
    And yes I was talking about individual files. It's a lot more efficient especially if the DB and webserver are on different machines as is frequently the case.
    But they aren't on different machines. And where do you have to store the updated content then? Sorry if understand you wrong, I'm not that experienced with such things.

  4. #29
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Xargo
    I don't get your point.
    Never mind! If you check out the translation site in my signature you will see proper URLs with no query string that all refresh properly and all use the same template.

    Using a query string when you are just opening a webpage is plain wrong. The query string should be used for passing unique and unknown data from the client to the server. Anything else is a strategy for the desperate.

  5. #30
    SitePoint Member
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bokehman
    Never mind! If you check out the translation site in my signature you will see proper URLs with no query string that all refresh properly and all use the same template.

    Using a query string when you are just opening a webpage is plain wrong. The query string should be used for passing unique and unknown data from the client to the server. Anything else is a strategy for the desperate.
    I get what you're trying to explain now. I don't agree with your opinion, they are just two different methods that results the same. The one is not better than the other. I don't see why that should be a strategy for the desperate, it's just a matter of taste.

  6. #31
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Xargo
    just two different methods
    Yes and one is right and the other is obviously wrong.
    Here is an example of correct use of a query string!

  7. #32
    SitePoint Member
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bokehman
    Yes and one is right and the other is obviously wrong.
    Here is an example of correct use of a query string!
    I know you can also use it like that, but why would it be wrong to use it like I do if I may ask?

  8. #33
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Xargo
    why would it be wrong?
    Because the value is already known to the writer of the pages. In the example I gave the value was not known to the script writer hence a form and query string were needed.

    The query string is for modifying content within a page, not for displaying different pages. Just because you can do it doesn't make it right.

  9. #34
    SitePoint Member
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bokehman
    Because the value is already known to the writer of the pages. In the example I gave the value was not known to the script writer hence a form and query string were needed.

    The query string is for modifying content within a page, not for displaying different pages. Just because you can do it doesn't make it right.
    It doesn't slow down, it's smooth, there are no disadvantages and no difference between the two methods, what makes the one less good than the other one?

  10. #35
    so shiny exigent's Avatar
    Join Date
    Nov 2005
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Xargo
    I'm sorry, I won't ever pay for a web hosting if there are so many free web hosts out there. I'm already paying for a com domain and in the future I'll have to pay for an mmorpg server too, that's more than enough.

    Btw, lvismer, can you please check my answer?

    The limitations of free hosts are immense. Most kick you out when you use too much bandwidth/space, a lot are scams or they put advertisements on your site.

    Most won't even give you enough "fuel" to run a popular website. If you plan on running a MMORPG, you'll most definately need at least shared web hosting (most likely dedicated if its very popular).

  11. #36
    SitePoint Member
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by exigent
    The limitations of free hosts are immense. Most kick you out when you use too much bandwidth/space, a lot are scams or they put advertisements on your site.

    Most won't even give you enough "fuel" to run a popular website. If you plan on running a MMORPG, you'll most definately need at least shared web hosting (most likely dedicated if its very popular).
    Well, then you got a wrong image of free web hosts. Eg. http://www.50webs.com (Unlimited bandwidth, 60MB space, unlimited websites on one account, very trustable and an extremely nice and fast support, but unfortunately no MySQL/PHP.) I know a few others like that, just use the Power Search of Free Web Hosts: http://www.free-webhosts.com/power-search.php.

  12. #37
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Xargo
    no disadvantages and no difference between the two methods
    Quote Originally Posted by Xargo
    but unfortunately no MySQL/PHP.
    Well for a start your method needs serverside scripting which unfortunately for you your server doesn't have. Doesn't that seem a bit of a disadvantage?

  13. #38
    SitePoint Member
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bokehman
    Well for a start your method needs serverside scripting which unfortunately for you your server doesn't have. Doesn't that seem a bit of a disadvantage?
    I'm not that stupid. That's not the host I'm using, I use http://777mb.com, but I don't recommend that as a nice host, the support is horrible, almost no pages of their website work, except from the site management pages of course. But I use it anyway, it has 777mb space and 7777mb bandwidth, one MySQL database and PHP support.


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
  •