Jump to content

submit button url encoding issue


sw9

Recommended Posts

Hi,

 

I've got a little form that is just a select box with certain dates in it and a submit button. when the submit button is pressed, the page is refreshed and an 'offset' GET var is added based on the select box. However, I need to also add another GET var to the url, but when I add this in and press the submit button I get urls like this:

 

?offset=2%2526c%253D8

 

What I need it to look like is this:

?offset=2&c=8

 

here is the form code I'm using:

 

<form>Select the date to view: 
<select name="offset" size="1">

<?php 
$channel = 8;
for ($i=-2; $i<11; $i++){
$day = mktime(0, 0, 0, date("m"), date("d")+$i, date("y"));
$str=date("l F j", $day);
$selected = "";

if( $i == $offset ){
  $selected = " selected ";
}
print "<option $selected value=\"".$i.rawurlencode("&c=").$channel."\">$str</option>";
}
?>
</select>
<input type="submit" value="Show Day">
</form>

 

Am I  not using rawurlencode correctly? I get these urls whether I use it or not...any help is appreciated!

Link to comment
https://forums.phpfreaks.com/topic/132614-submit-button-url-encoding-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.