Php uri

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • simpleleslie
    New Member
    • Nov 2014
    • 4

    Php uri

    Hi guys, I'm new here, I am coding a code just like this

    http://mydomain.com/index.php?actio n=View Property&id=211

    The Property is called example "Manila Condo Suite"

    how can I show this in the URL bar like this

    http://mydomain.com/index.php?Manil a Condo Suite or similar like that. I don't want to show in the URL those variables.

    thank you very much.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    for an URL to match the desired dataset you need a unique identifier. if "Manila Condo Suite" fulfills that condition you can work with that. (i.e. your PHP code needs to look in its data store for that key). the remainder for you would be either rewriting the URL so the $_GET is populated properly or you parse the raw URL for that key. be aware though that both ways limit the things your URL space can do* (i.e. what you can do with your URL).

    * - index.php?actio n=View Property&id=211 is more flexible than
    index.php?Manil a Condo Suite

    Comment

    • simpleleslie
      New Member
      • Nov 2014
      • 4

      #3
      Hi Dormilich,

      it's okay if it's limited, I just don't want to show the id 211, how can I do that?

      thanks

      Comment

      • simpleleslie
        New Member
        • Nov 2014
        • 4

        #4
        Hi, how about URL encoding? thanks

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          I just don't want to show the id 211, how can I do that?
          by one of the ways described above

          how about URL encoding?
          URL encoding simply is an escape mechanism so that the encoded string does not contain characters (esp. ?, &, and =) that could be misinterpreted by the URL parser.

          Comment

          • simpleleslie
            New Member
            • Nov 2014
            • 4

            #6
            @Dormilich,

            Thank you very much.

            Comment

            Working...