Hi

So this is probably quite easy but I can’t find the solution.
I want to have a form and after the user have chosen in the list the address need to be sent to the browser.

Here is a snip from my code.

<?php
$data = "ligaid=12&serie=2";

echo "<form action='index.php' ENCTYPE='application/x-www-form-urlencoded' name='sasong' method='GET'>
<select name='spela' ENCTYPE='text/plain' class='kommentera'>
<option value=''>---- Tidigare säsonger ----</option>
<option value='".$data."'>Session 1</option>
<option value='asd6'>Session 2</option>
<option value='asd8'>Session 3</option>
<option value='asd10'>Session 4</option>
</select>
<input type='submit' value='Submit'>
</form>";
?>

The address will now be

index.php?spela=ligaid%3D12%26serie%3D2

when I choose alternative "Session 1"

But I want it to be

index.php?spela=ligaid=12&serie=2

Can anyone help me?

    That's fine. The data is merely being urlencoded.

      Yes can I get it undecoded?
      I don't want the address to be like that. I need it to look "normal"

        I don't want the address to be like that. I need it to look "normal"

        That is normal. What you are suggesting is abnormal.

        EDIT:
        Maybe I should point out that the browser will automatically decode it.

          the problem is that in the address bar it looks wrong.
          like this index.php?spela=ligaid%3D12%26serie%3D2

          I need to get it to look like this for the user and not like above
          index.php?spela=ligaid=12&serie=2

          I put up an exampel
          http://bbs-crew.myftp.org/~linux/form/

          If you use the first choise "Session 1" and press submit the address will be "http://fun.bbs-crew.myftp.org/test/index.php?spela=ligaid%3D12%26serie%3D2" and I want it to be "http://fun.bbs-crew.myftp.org/test/index.php?spela=ligaid=12&serie=2"

            the problem is that in the address bar it looks wrong.

            That is not a problem at all. What you should be concerned with is whether the data sent is correct. Check with say,

            if (isset($_GET['spela'])) {
                echo htmlspecialchars($_GET['spela']);
            }

            If the data is correct, then you should not care less about what some browser address bar displays.

              Well the problem is I have to convert evrything with htmlspecialchars I need to more or less redo evrything on the page.

                Well the problem is I have to convert evrything with htmlspecialchars I need to more or less redo evrything on the page.

                What do you mean? You should be using htmlspecialchars() to avoid malicious script injection in the first place.

                  the page is a build by someone else and I can't rewrite it right now. I don't have that time.

                  My next idea if this is imposible to solve is to make a self executed link or header to make it look correct

                    Write a Reply...