Drop Down Menu Problem

Associate
Joined
1 May 2006
Posts
810
Location
Bristol, UK
Good Morning!

I'm having a little problem with a drop down menu. Here is the code:
Code:
<form action="<?php $self ?>" method="get">
<table align="center">
<tr>
<td>Select Gallery: <select name="Galleries">
<?php do { ?><option value="page=gallery&dir=<?php echo $Galleries_Row['directory']; ?>"><?php echo $Galleries_Row['title']; ?></option><? } while ($Galleries_Row = mysql_fetch_assoc($Galleries)); ?>
</select><input type="submit" value="Go!"></td>
</tr>
</table>
</form>
This form appears at the top of the "gallery" page (Linky Linky). My aim is to have site visitors select a 'gallery' from the drop down menu, click the 'Go!' button and be taken to said gallery.
However, when the 'Go!' button is clicked, the resulting link looks like this:
Code:
http://jasonsummers.co.uk/index.php?Galleries=page%3Dgallery%26dir%3D%2Fimages%2Ffriends
For the script to work it needs to be:
Code:
http://jasonsummers.co.uk/index.php?page=gallery&dir=/images/friends

I should probably mention that I haven't written the part of the script that actually displays the images yet. I can tell that there is something wrong because there needs to be "page=gallery" somewhere in the link to comply with the security measures I have set on index.php.

Any ideas on how I can get the link to appear correctly, maybe some parsing involved?

Cheers.
 
Associate
Joined
1 May 2006
Posts
810
Location
Bristol, UK
bump

anyone?

edit: i've managed to fix part of the problem by removing "page=gallery&dir=" from the <option> tag and changing the name of the <select> tag to dir and adding a hidden field called "page" with value "gallery".

Now the url that the script tries to go to looks like this:
Code:
http://jasonsummers.co.uk/index.php?page=gallery&dir=%2Fimages%2Ffriends
Obviously where this is "%2F" there is meant to be a "/". Is there any code I can use to replace all "%2F" with "/" in variable $dir?

Cheers

edit2: tracked it down to a database problem. "%2F" is valid apparrently. However the link needed to be:
Code:
http://jasonsummers.co.uk/index.php?page=gallery&dir=images%2Ffriends%2F
so annoyed with myself lol!
 
Last edited:
Top