I need help with a very simple form code, please help me

Discussion in 'HTML & Website Design' started by Biden, Feb 28, 2009.

  1. #1
    Hello,

    I need some help with a my new site all i need is a simple code that is basically is a form that looks like this


    [​IMG]

    the form sends the visitor to /allowed.html or www.mysite.com/allowed.html if they write the right code "123456" for example and if they write anything else they get error and they get to enter it again

    [​IMG]

    can anyone do this for me please....!
     
    Biden, Feb 28, 2009 IP
  2. American

    American Guest

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Have one file....

    example index.html or index.php
    <form action="submit.php" method="post">
    Code: <input type="text" name="key" />
    <input type="submit" />
    </form>
    HTML:
    Another file, submit.php

    <?php
    $d=date("D");
    if ($_POST["name"]=="123456")
      header("Location: www.mysite.com/allowed.html"); 
    else
      header("Location: www.mysite.com/denied.html"); 
    ?>
    PHP:
    That should do it :)
     
    American, Feb 28, 2009 IP
  3. Biden

    Biden Active Member

    Messages:
    620
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Hello buddy,

    thanks a lot for your help but im getting this error
    [B]Warning[/B]: Unexpected character in input: '\' (ASCII=92) state=1 in [B]/home2/webmaste/public_html/ws/submit.php[/B] on line [B]3[/B]
    
    [B]Parse error[/B]: syntax error, unexpected T_STRING in [B]/home2/webmaste/public_html/ws/submit.php[/B] on line [B]3[/B]
    Code (markup):
    edit that happened when i used wordpad, when i use note pad i got this error

     
    Biden, Feb 28, 2009 IP
  4. American

    American Guest

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Sorry, I sorda rushed that lol, and I didn't fix a few things...


    Have one file....

    example index.html or index.php
    <form action="submit.php" method="post">
    Code: <input type="text" name="key">
    <input type="submit">
    </form>
    HTML:
    Another file, submit.php

    <?php
    if ($_POST["key"]=="123456")
      header("Location: http://www.mysite.com/allowed.html"); 
    else
      header("Location: http://www.mysite.com/denied.html"); 
    ?>
    PHP:
    The above 2 files exactly as are working for me.

    Edit: here's my working test: http://www.shock-host.net/test/index.php

    Edit 2: I also suggest you use Notepad to edit .php files. Wordpad may try to save formatting in the PHP file which servers will not be able to process as PHP.
     
    American, Feb 28, 2009 IP
  5. Biden

    Biden Active Member

    Messages:
    620
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    60
    #5
    please check out this one...
    http://www.webmasterstage.com/test/
    this is really weird...

    that is exactly what i need!!
    hmmm ...

    could it be because i uploaded it in a different way i heard there is binary, acid, auto or something like this.
    or could it be because i used notepad it's making it all in 1 line..?
     
    Biden, Feb 28, 2009 IP
  6. American

    American Guest

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Have you tried editing it in notepad? If so, on your server rename the submit.php to submit.txt

    I've tried it under PHP4 and PHP5, and it works under both on my server. Not sure, if not an editor issue, what it could be. :(

    Edit: Try the attachment

    Edit2: I use SmartFTP 2.5 x64 and have my transfer settings on auto.
     

    Attached Files:

    American, Feb 28, 2009 IP
  7. Biden

    Biden Active Member

    Messages:
    620
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    60
    #7
    yes i had PHP version 5.2.5 on that..
    i've also tried it on a different hosting
    www.circassion.com/index.php

    hmmm.. if you know anyother methods to create the samething please let me know

    i'm leaving you feedback right now
     
    Biden, Feb 28, 2009 IP
  8. American

    American Guest

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Hmmm, send me a message on MSN. I'll see if I can help you; it may be an upload issue, is there any other way you can upload the file? (Maybe a control panel or web interface?)

    MSN: michaelhart [at] michaelhart.me
    Yahoo:
     
    American, Feb 28, 2009 IP
    Biden likes this.