Results 1 to 6 of 6

Thread: Parse URL parameters into simple HTML?

  1. #1
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default Parse URL parameters into simple HTML?

    Hi all.

    I know very little PHP, but what I want to do is very basic. Looking at the URL of this Post New Thread page, it ends with "?do=newthread&f=11". I want to output these types of parameters like so:

    Code:
    <input type="hidden" name="do" value="newthread" />
    <input type="hidden" name="f" value="11" />
    Is this possible/easy?

    Thanks for any responses!

  2. #2
    Join Date
    Jul 2008
    Posts
    199
    Thanks
    6
    Thanked 58 Times in 57 Posts

    Default

    These are called $_GET parameters. If you want to list only specific one's, you'd use this:
    PHP Code:
    echo '<input type="hidden" name="do" value="' $_GET['do'] . '" />';
    echo 
    '<input type="hidden" name="f" value="' $_GET['f'] . '" />'
    If you want it to loop through all the $_GET parameters, you'd use this:
    PHP Code:
    foreach($_GET as $key => $value)
      echo 
    '<input type="hidden" name="' $key '" value="' $value '" />'

  3. The Following User Says Thank You to techietim For This Useful Post:

    jlizarraga (09-01-2008)

  4. #3
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    Thank you!

  5. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #5
    Join Date
    Apr 2008
    Location
    San Diego, CA
    Posts
    352
    Thanks
    57
    Thanked 6 Times in 6 Posts

    Default

    Okay, I'm trying to take this all in. @_@

    For 1.3: What does this mean exactly, that it is bad to use PHP in conjunction with "error-corrected into validity" XHTML? My page is all valid XHTML 1.0 strict (and from what I understand from the links is being displayed as HTML by browsers). When I view source on this page, I see XHTML. Does the forum take extra steps to be compatible?

    4.1 shouldn't be a problem, this is all temporary.

    Thanks.

  7. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I suggest reading the associated link(s). Please don't use DD to judge code quality
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •