Web Analytics Made Easy -
StatCounter include code on false text input - CodingForum

Announcement

Collapse
No announcement yet.

include code on false text input

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • include code on false text input

    Hi guys.

    What I'm trying to do is have my PHP code include a file when a correct word is typed into a text box. If the wrong word is typed, I'm aiming to for it to echo an error message. Heres what I have so far (I know it's most likely very wrong, but I was hoping someone could help me out! )

    PHP Code:
    <?php

    $password 
    "something";

    if ( 
    $password == "something" ) {
        include(
    "correct.php");
        }
    else
    echo 
    "Wrong!<br />"


    ?>
    I have the textbox named "password", but am not sure what I should be using for the method and action tags as part of the form.

    Thanks in advance!

    -psy

  • #2
    Use method="post" and action="thenameofthephpfileyoushowabove.php"

    Then in that php file, change to:
    $password = $_POST['password'];
    ...assuming your input tag name is "password".

    Dave

    Comment


    • #3
      Thanks tracknut! I'll test it out now. I knew I was missing something, turned out it was the $_POST part.

      EDIT: Works! Thanks a lot tracknut.
      Last edited by psy; Sep 2, 2011, 12:44 AM.

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎