How to shorten url from form (method="get")? (5 posts)

  1. cuk
    Posted 2 years ago #


    I've created a form on my website which acts like a search engine for my dictionary. Everything's ok until I start using all these options for advanced search and URL (which contains all the data necessary for the mysql query) starts looking something like this:


    Not only this is impractical, but I'd rather visitors didn't have to see all that data in the URL.

    I've written this code in a page template and omitted the action attribute as it would otherwise redirect me to my homepage.

    Is there a way I could continue using method get, but make it invisible for the visitors (or encode it)?

  2. Funkywebsites
    Posted 2 years ago #

    you could encode it yourself into a simple string. with a little php code..

  3. Funkywebsites
    Posted 2 years ago #

    it would be like

    let me find a code for you. and then the website would look at the query and decode it :)

  4. Funkywebsites
    Posted 2 years ago #


    put the $query in the url path on form get..

    then get it to decode it back after...

    with a simple chunk split i think..

  5. Funkywebsites
    Posted 2 years ago #

    $newquery = md5($newstr);

    $explodethis = explode(",", $newquery);

    echo $explodethis[0]; // qry1
    echo $explodethis[1]; // qry2
    echo $explodethis[2]; // qry3

Topic Closed

This topic has been closed to new replies.

About this Topic