Jump to content

Recommended Posts

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?  :)

Link to comment
https://forums.phpfreaks.com/topic/129440-solved-get-in-forms-give-bad-address/
Share on other sites

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.

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.