You are here: Re: drop down selection box « HTML « IT news, forums, messages
Re: drop down selection box

Posted by J.O. Aho on 03/05/07 10:13

the red dot wrote:
> "Adrienne Boswell" <arbpen@yahoo.com> wrote in message
> news:Xns98E9CB0427D47arbpenyahoocom@69.28.186.121...
>> Gazing into my crystal ball I observed "the red dot" <red@dot.spot>
>> writing in news:yJCdncQCD-_83nbYRVnytAA@eclipse.net.uk:
>>
>>> "Adrienne Boswell" <arbpen@yahoo.com> wrote in message
>>> news:Xns98E98C758EC32arbpenyahoocom@69.28.186.121...
>>>> Gazing into my crystal ball I observed "the red dot" <red@dot.spot>
>>>> writing in news:SoWdnZ3qus8etnbYnZ2dnUVZ8s-qnZ2d@eclipse.net.uk:
>>>>
>>>>> this is driving me crazy but i am trying to find some examples of a
>>>> drop
>>>>> down selection box with a go button that doesnt use javascript...
>>>>> is
>>>> this
>>>>> possible or am i barking up a very wrong tree?
>>>>>
>>>>>
>>>> What's wrong with plain links? What about users without javascript
>>>> (Google comes to mind)? How about:
>>>>
>>> im attempting to find a way to do it without javascript
>>> plain links will mess up design/layout especially as the film titles
>>> are a bit long in some case so if a user increases the font size too
>>> much the whole thing will go mad
>> Yup, I see what you mean. Can you do it server side, and not be
>> dependent on js at all?
>>
>> <form method="post" action="<?php_self?>"
>> <fieldset>
>> <legend>Choose a Film</legend>
>> <label for="film">Title: </label>
>> <select name="film" id="film" onchange="this.form.submit();">
>> <option value="#"></option>
>> <option value="#">Fighting the Taliban</option>
>> <option value="#">Meeting the Taliban</option>
>> <option value="php/afghan.php">Afghan Ladies' Driving School</option>
>> </select>
>> <input type="submit" "value="GO" />
>> </fieldset>
>> </form>
>>
>> This will work for js browsers and non-jsbrowsers. Just put a little
>> php at the top looking for what the script submitted, and redirect from
>> there.
>>
>>
> ahh i seem to remember seeing that on my google travels but couldnt quite
> get my head around it, is it possible for you to post the link (if you have
> it) so i can go and have another (deeper) investigation, what do you mean by
> put a little php at the top? as usual the more i know the less i seem to
> understand.

You must use a redirect page specially if you want to use anchors in the same
page.

In your html pages:

<form method="post" action="redirect.php"
<fieldset>
<legend>Choose a Film</legend>
<label for="film">Title: </label>
<select name="film" id="film" onchange="this.form.submit();">
<option value="#"></option>
<option value="#">Fighting the Taliban</option>
<option value="#">Meeting the Taliban</option>
<option value="php/afghan.php">Afghan Ladies' Driving School</option>
</select>
<noscript><input type="submit" "value="GO" /></noscript>
</fieldset>
</form>

I assume the "this.form.submit()" works when the javascript is enabled, then
in theory you wouldn't need the submit button, so set it inside noscript tags
that should enable the button for none javascripters (may not work n old
browsers like mosaic).


--- redirect.php ---
<?PHP
switch($_REQUEST['film']) {
case 'taliban':
header('Location: http://www.example.net/pagename.html');
exit;
case 'driver':
header('Location: http://www.example.net/afghan.html');
exit;
case '#hello':
/* not sure if this works */
header('Location: http://www.example.net/afghan.html#hello');
exit;
default:
header('Location: http://www.example.net');
exit;
}
?>
--- eof ---

Using a redirect script makes you need only one server side script instead of
making all your pages to server side scripts.

--

//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация