Questions › Problem Creating Simple Shopping Cart with PHP

asked on 17th Oct 2016

can i ask how to change the current $current_url = urlencode($url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); echo $current_url; ?>" /> to dollar or to peso

    Add Answer
    All HTML codes will be stripped in the comment, except inline <code> HTML tag.
    1 Answer
    answered on

    Some Guidance Regarding URI Query PHP Functions urlencode/urldecode, rawurlencode/rawurldecode.

    The difference between urlencode and rawurlencode is that

    urlencode encodes according to application/x-www-form-urlencoded (space is encoded with +) while

    rawurlencode encodes according to the plain Percent-Encoding (space is encoded with %20).

    I have re written the Code below

    &lt;?php
    $url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'';
    $current_url = urlencode($url);
    echo $current_url; //will output encoded url
    echo urldecode($current_url); //will output the decoded raw url
    ?&gt;

    Kindly make Changes to rawurlencode If your URL URI has Spaces

      All HTML codes will be stripped in the comment, except inline <code> HTML tag.

      Can You Answer this? Help us answer the question!

        • Answer
        Supports basic Markdown syntax. Excluded syntaxes (Headers, Lists, Blockquotes, Table, Images)