URL decoding

Hello,

I’m new to PHPHelp but not to PHP. I have a issue and can’t get it to work for some reason. So I hope someone can help me out.

Let me try to explain it real quick.
Below in the PHP tags I have a code which doesn’t work properly (removed all unnecessary parts).

I have a dropdown menu that give a value from my SQL database.I want to use the GET function to get two values inside the URL.
But for some reason after I hit submit it encode the URL and then it doesn’t work anymore.

For example: &id= will be displayed as %26id%3D

[php]<?php

include ‘mysql.php’;

$second_part = “&id=”;

?>

<?php $sql="SELECT * FROM table"; $result =mysql_query($sql); while ($data=mysql_fetch_assoc($result)){ ?> <?php echo $data['number'] ?> <?php } ?>

[/php]

As you can see, at the option value I added $second_part in the middle, because it has to show the ID behind it so you get a link like this:

[php]page.php?prijsopgave=RMA1000007&id=tHJTh7-ggcBLh8pGjWRP3qHPW[/php]

But instead it show me:

[php]page.php?prijsopgave=RMA1000007%26id%3DtHJTh7-ggcBLh8pGjWRP3qHPW [/php]

I think its a decoding/encoding issue. I tried so many things but can’t get it to work.
Can you see what I did wrong here? Or maybe there is a better way to fix this? Or is there a better way to separate the <?php echo $data['id'] ?> in the link?

Hope to hear from you soon.

Best regards,
Marco

Let us decide what is a unnecessary. You actually removed some important code. Post your full code.

You are going about it the wrong way. Part of the fix lies in the rest of your code.

Sponsor our Newsletter | Privacy Policy | Terms of Service