Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Feb 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    redirecting to new page based on information supplied

    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.

  • #2
    New Coder
    Join Date
    Feb 2003
    Location
    ROMANIA
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Claudiu Iacob - Romania

  • #3
    Regular Coder
    Join Date
    Oct 2002
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer

    I think the question is something like:

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

    Jerome
    Last edited by Jerome; 02-28-2003 at 10:56 AM.

  • #4
    New to the CF scene
    Join Date
    Feb 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #5
    New Coder
    Join Date
    Feb 2003
    Location
    ROMANIA
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?
    Claudiu Iacob - Romania

  • #6
    New Coder
    Join Date
    Feb 2003
    Location
    ROMANIA
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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).
    Claudiu Iacob - Romania


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •