Forum Moderators: not2easy

Message Too Old, No Replies

Weather feed based on users zip with cookies

         

akula

2:14 am on May 15, 2005 (gmt 0)

10+ Year Member



I am looking for a script or feed that will load the current weather conditions/forecast based on the visitor's ZIP code. I would like for that zip to be stored in a cookie so when the visitor return, they do not have to enter their ZIP code again.

I have found sites that offer forecasts and conditions based on a ZIP but none that offer to place a cookie.

Anyone know of sites or code to do that?

Thanks.

treeline

2:25 am on May 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to webmasterworld!

Why not just set your own zipcode cookie, and read it when they come back, then hand it off to your weather script?

akula

2:34 am on May 15, 2005 (gmt 0)

10+ Year Member



Thanks for the welcome.

I do not know how to read or write cookies.

I figured there was something like this out there, although my searches found nothing.

treeline

3:18 am on May 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What kind of program do you use for editing your websites? Dreamweaver? Frontpage?

Any familiarity with perl, cgi, php, or javascript? There's several ways to do this, but it's easier to start from what you know already.

akula

3:30 am on May 15, 2005 (gmt 0)

10+ Year Member



I use Dreamweaver and do some hand coding in notepad. I am somewhat familiar with javascript, less with the others.

Oh, and starting to figure out PHP recently.

treeline

4:21 am on May 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A search on google for <META http-equiv set-cookie> will get you a lot of good info on how this is done, if you don't want to use scripting languages.

A nifty dreamweaver extension for get cookie and set cookie can be found at: (scroll down)

[andrewwooldridge.com...]

Or for how to with PHP:

[us3.php.net...]

akula

2:48 am on May 28, 2005 (gmt 0)

10+ Year Member



Cookie problem has been worked out, thanks for advice.

New problem involves Firefox. Upon the user entering their zip code into the form text box and clicking submit button, it reloads the page within the layer ( kind of like loading a frame within itself) and it will keep doing that over and over the more times a new zip code value is entered.

In IE it works fine, by reloading the entire page.

Here is part of the code:

<form action="http://webpageurl.com/" method="post" name="setCookieForm" >

Enter your zip code <input name="setCookieFormZipCode" maxlength=5 type="text" size=5 class=bcTxtBox>
<input type="submit" value="Go" class=bcGoBut onClick="validate()">

</form>