...

View Full Version : redirecting to new page based on information supplied



stumpy
02-28-2003, 06:10 AM
i want to be able to redirect visitors to two different pages on my site, depending on the text they input - probobly best if I explain in a little detail ;o)
They enter a postcode on a page, click a submit button, and if the first 4 letters match a predefined string, they are sent to a registration page (register.htm) otherwise the postcode they entered is added to a postcode.csv file, and they are re-directed to another page (notyet.htm)
ie the cose i want is PO13
they enter PO13 4DB, click the button and are sent to register.htm
or
they enter say NE12 5TF, click the submit button and the NE12 is added the the end of the postcode.csv file, and they are sent to the notyet.htm page.
Any help will be greatly appreciated, as you've guessed I am new to coding.
PS I can not run PHP or ASP on my site, it's a basic hosting site only.
Cheers
Stumpy.

claudiuiacob
02-28-2003, 11:44 AM
I must face it:

I DONT 'T GET IT!

Why don't you just put your code here instead?

It will make much more sense, I think.

Jerome
02-28-2003, 11:53 AM
I think the question is something like:

function postalcode()
{
if(input==12345)
{
window.location.replace('oke.htm');
}
else
{
window.location.replace('register.htm')
}
}

Jerome

stumpy
02-28-2003, 02:48 PM
I dont think I made myself very clear in my request, sorry Jerome!
Basically the program flow i need is;

1. Form input postcode
2. click submit button
3. If the first 4 chars in postcode="PO13" then goto 7
4. save the value of postcode to file interest.csv
5. goto www.blah.com/notyet.htm
6. STOP
7. goto www.blah.com/register.htm
8. STOP

I hope this has made my request more straightforward (I told you I am a coding numpty!)

Cheers

claudiuiacob
03-02-2003, 01:53 PM
OK, Stumpy now all makes sense to me, except:


4. save the value of postcode to file interest.csv

Do you plan to use JavaScript for that? As I know, JS is a client side scripting language. Its "power" merely allows it to work with the browser itself.
The only "file" JS can write into are those
*.cookie files in your "Temporary Internet Folder"
onto your HDD.

If I'm wrong, please somebody correct me (though I guess I'm not).

I think what you need is some server side script, as well, some database support. The script will check what you need to check,
open a connection to a database - say MySQL - write into that value of postal code and then redirect where you want.

Or you can use JS to check the value the user types in, and the JS script will redirect your browser to

http://www.adress.com/process.php?value_inputed_by_user

where "process.php" is the file in which your server side script (php in this example) resides.

Does anybody knows otherwise?

claudiuiacob
03-02-2003, 02:01 PM
P.S.:

Now I see you can't run server side scripts because your host doesn't allow you to.

Try

http://www.as.ro

It offers free PHP & MySQL support.

(I know, no advertising around here, but I just gave the man
a hand). :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum