Do I have to use CGI?

Hi. My web hosting package doesn't allow CGI scripting. So how can I do the following for example: <br />
In a text box, user types in a City name. On Submit, the name is looked up and the approriate link with <!-- w --><a class="postlink" href="http://www.weather.com">www.weather.com</a><!-- w --> is opened. This is an example of the kind of thing I want to do. Does this have to be done with a CGI script? I'm very new to this! :( Thanks in advance! <br />
<br />
Ig<!--content-->weather.com has their own website tool that does what you want to do, why not use that?<br />
<br />
<!-- m --><a class="postlink" href="http://oap2.weather.com/oap/index.html?from=servicesindex">http://oap2.weather.com/oap/index.html? ... vicesindex</a><!-- m --><br />
<br />
If you want to do something a bit different you can use PHP - you don't need to use CGI. PHP is the easiest to learn and most powerfull server-side scripting language (in my opinion).<br />
<br />
<!-- m --><a class="postlink" href="http://www.php.net">http://www.php.net</a><!-- m --><!--content-->In your specific example of <!-- w --><a class="postlink" href="http://www.weather.com">www.weather.com</a><!-- w --> you do not necessarily need a server-side script. You will need some javascript that will link to a URL. Something like this.... <br />
<br />
<!-- m --><a class="postlink" href="http://www.weather.com/weather/local/94566">http://www.weather.com/weather/local/94566</a><!-- m -->? />
(on same line)lswe=94566&lwsa=WeatherLocalUndeclared<br />
This will give me the weather in Pleasanton, CA 94566. You will need an array that lists all the cities you want to include and, looking at the URL needed, I would recomend you translate the city to a zip code in your script.<br />
<br />
You could instead use a <select...> and a little javascript like this...<br />
<select><br />
<option value="http://www.weather.com/weather/local/94566?<br />
(on same line)lswe=94566&lwsa=WeatherLocalUndeclared>Pleasanton<br />
<option value="......">City name<br />
etc.<br />
</script><br />
To check out what the URL needs to be, go to the site, enter a city or zip, and look at the URL in your browser address field.<br />
<br />
Not the easiest thing in the world, but if you know javascript you should'nt have too much trouble. If you get into trouble on the way, post whatever code you have and I'm sure someone will help.<br />
<br />
Good Luck :)<!--content-->Great - very helpful thanks. Next question! - How do I call an array? If that is too detailed, can you point me to where I can find out. Thanks!<!--content-->Do you know Javascript? If not, here's a link that Dave Clark (our resident expert) suggests for a Javascript tutorial<br />
<!-- m --><a class="postlink" href="http://www.wdvl.com/Authoring/JavaScript/index.html">http://www.wdvl.com/Authoring/JavaScript/index.html</a><!-- m --><br />
<br />
Not knowing exactly what you are doing makes it a little difficult to suggest the best path. But here a simple script that will sort of work.<br />
<br />
<html><head><title>Untitled</title><br />
<script type="text/javascript"><br />
<!--<br />
function change(data) {<br />
location = "http://www.weather.com/weather/local/" + data.options[data.selectedIndex].value;<br />
}<br />
// assumes "http://www.weather.com/weather/local/" is common to all zip codes<br />
//--><br />
</script><br />
</head><br />
<br />
<body><br />
<form><br />
<select onChange="change(this)"><br />
<option>Select a city<br />
<option value="94566?lswe=94566&lwsa=WeatherLocalUndeclared">Pleasanton<br />
<option value=".......">city2<br />
<option value=".......">city3<br />
</select><br />
</form><br />
</body><br />
</html><!--content-->
 
Back
Top