help pls..how to clear a url query string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shotokan99

    help pls..how to clear a url query string

    hi guys,

    my url is in this form: http://www.mysite.com?user=zen

    what to do to remove the query string (..?user=zen) and make my url to
    this form: http://www.mysite.com

    tnx

  • Rami Elomaa

    #2
    Re: help pls..how to clear a url query string

    "shotokan99 " <soft_devjava@y ahoo.comwrote in message
    news:1177405709 .175883.200600@ t39g2000prd.goo glegroups.com.. .
    hi guys,
    >
    my url is in this form: http://www.mysite.com?user=zen
    >
    what to do to remove the query string (..?user=zen) and make my url to
    this form: http://www.mysite.com

    $url = 'http://www.mysite.com? user=zen';
    list($shorturl) = explode('?', $url);
    echo $shorturl;

    --
    Rami.Elomaa@gma il.com

    "Good tea. Nice house." -- Worf


    Comment

    • iktorn

      #3
      Re: help pls..how to clear a url query string

      Rami Elomaa napisa³(a):
      "shotokan99 " <soft_devjava@y ahoo.comwrote in message
      news:1177405709 .175883.200600@ t39g2000prd.goo glegroups.com.. .
      >hi guys,
      >>
      >my url is in this form: http://www.mysite.com?user=zen
      >>
      >what to do to remove the query string (..?user=zen) and make my url to
      >this form: http://www.mysite.com
      >
      >
      $url = 'http://www.mysite.com? user=zen';
      list($shorturl) = explode('?', $url);
      echo $shorturl;
      >
      there is a shorter way:
      echo strtok($url,'?' );

      ;)

      --
      Wiktor Walc

      Comment

      • ZeldorBlat

        #4
        Re: help pls..how to clear a url query string

        On Apr 24, 5:08 am, shotokan99 <soft_devj...@y ahoo.comwrote:
        hi guys,
        >
        my url is in this form: http://www.mysite.com?user=zen
        >
        what to do to remove the query string (..?user=zen) and make my url to
        this form:http://www.mysite.com
        >
        tnx
        $parts = parse_url('http ://www.mysite.com? user=zen');
        $url = $parts['scheme'] . '://' . $parts['host'];

        Comment

        • shotokan99

          #5
          Re: help pls..how to clear a url query string

          tnx...it did the trick ;-)

          Comment

          • C.

            #6
            Re: help pls..how to clear a url query string

            On 24 Apr, 10:22, "Rami Elomaa" <rami.elo...@gm ail.comwrote:
            "shotokan99 " <soft_devj...@y ahoo.comwrote in message
            >
            news:1177405709 .175883.200600@ t39g2000prd.goo glegroups.com.. .
            >
            hi guys,
            >
            my url is in this form: http://www.mysite.com?user=zen
            >
            what to do to remove the query string (..?user=zen) and make my url to
            this form:http://www.mysite.com
            >
            $url = 'http://www.mysite.com? user=zen';
            list($shorturl) = explode('?', $url);
            echo $shorturl;
            >
            --
            Rami.Elo...@gma il.com
            >
            "Good tea. Nice house." -- Worf

            It's probably safer to use parse_url() see http://www.php.net/function.parse-url

            C.

            Comment

            Working...