Sun_Blood Posted October 21, 2008 Share Posted October 21, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/129440-solved-get-in-forms-give-bad-address/ Share on other sites More sharing options...
ratcateme Posted October 21, 2008 Share Posted October 21, 2008 what is wrong with the url? what values to you want to get at the end. Scott. Quote Link to comment https://forums.phpfreaks.com/topic/129440-solved-get-in-forms-give-bad-address/#findComment-671094 Share on other sites More sharing options...
Sun_Blood Posted October 21, 2008 Author Share Posted October 21, 2008 I'll get index.php?spela=ligaid%3D12%26serie%3D2 when I use my code but I want to have index.php?spela=ligaid=12&serie=2 What I want is to get rid of the %3D and %26 that makes me address look wrong Quote Link to comment https://forums.phpfreaks.com/topic/129440-solved-get-in-forms-give-bad-address/#findComment-671100 Share on other sites More sharing options...
ratcateme Posted October 22, 2008 Share Posted October 22, 2008 but what values are you trying to get at the end of this and does it really matter what the url looks like? what you are saying will result in $_GET['spela'] will be 'ligaid=12'; and $_GET['serie'] will be 2 are these the results you are looking for? Scott. Quote Link to comment https://forums.phpfreaks.com/topic/129440-solved-get-in-forms-give-bad-address/#findComment-671435 Share on other sites More sharing options...
Sun_Blood Posted October 22, 2008 Author Share Posted October 22, 2008 yes that is true but that was only a exampel. On the real page the address is longer and the pages before can't manage that scrambled address if I don't rewrite evrything to use htmlspecialchars, and I don't have that time. If this can't be done I'll use post insted but then the page cant be bookmarked Quote Link to comment https://forums.phpfreaks.com/topic/129440-solved-get-in-forms-give-bad-address/#findComment-671546 Share on other sites More sharing options...
JonnoTheDev Posted October 22, 2008 Share Posted October 22, 2008 You cannot have a url formatted like: index.php?spela=ligaid=12&serie=2 You could however use: /index/ligaid=12/serie=2 Requires rewrite and use of urldecode() Quote Link to comment https://forums.phpfreaks.com/topic/129440-solved-get-in-forms-give-bad-address/#findComment-671655 Share on other sites More sharing options...
Sun_Blood Posted October 22, 2008 Author Share Posted October 22, 2008 Thanks for all the response I solved this by using post insted of get and then use a small javascript to change the location of the user to the correct address Quote Link to comment https://forums.phpfreaks.com/topic/129440-solved-get-in-forms-give-bad-address/#findComment-671904 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.