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 Coder
    Join Date
    Jul 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to show download link after text input

    I want a user to have to enter a pin into a text input box (i.e 1234) and when they click submit a download appears.

    Is this possible? I will set the code within my code if possible.

    Cheers.

  • #2
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    will the pin change or stay the same?
    if it stays the same its easy enough

  • #3
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>

    <body>
    <?PHP     
        
    if (isset($_POST['pin'])){
            if (
    $_POST['pin'] == '1234'){
            echo 
    '<a href="yourlink.ext">Click here to download</a>';
            }else{
            echo 
    'Incorect Pin - Please try agian
    <form id="form1" name="form1" method="post" action="">
      <label for="pin">Enter Pin: </label>
      <input type="text" name="pin" id="pin" />
      <input type="submit" name="submit" id="submit" value="GO" />
    </form>'
    ;
            }
        }else{
            echo 
    '<form id="form1" name="form1" method="post" action="">
      <label for="pin">Enter Pin: </label>
      <input type="text" name="pin" id="pin" />
      <input type="submit" name="submit" id="submit" value="GO" />
    </form>'
    ;
        }
    ?>

    </body>
    </html>
    Last edited by Arcticwarrio; 07-24-2012 at 01:26 PM.

  • #4
    New Coder
    Join Date
    Jul 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is great! works a treat,

    Only issue is i have my content placed in switch able divs, and when you enter password it closes the div, Is there any chance of auto opening the lnk if pin is correct?

    Thank you.

    Quote Originally Posted by Arcticwarrio View Post
    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>

    <body>
    <?PHP     
        
    if (isset($_POST['pin'])){
            if (
    $_POST['pin'] == '1234'){
            echo 
    '<a href="yourlink.ext">Click here to download</a>';
            }else{
            echo 
    'Incorect Pin - Please try agian
    <form id="form1" name="form1" method="post" action="">
      <label for="pin">Enter Pin: </label>
      <input type="text" name="pin" id="pin" />
      <input type="submit" name="submit" id="submit" value="GO" />
    </form>'
    ;
            }
        }else{
            echo 
    '<form id="form1" name="form1" method="post" action="">
      <label for="pin">Enter Pin: </label>
      <input type="text" name="pin" id="pin" />
      <input type="submit" name="submit" id="submit" value="GO" />
    </form>'
    ;
        }
    ?>

    </body>
    </html>

  • #5
    New Coder
    Join Date
    Jul 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    DONT WORRY,

    I have worked it out using iframe

    Quote Originally Posted by farnhamit View Post
    This is great! works a treat,

    Only issue is i have my content placed in switch able divs, and when you enter password it closes the div, Is there any chance of auto opening the lnk if pin is correct?

    Thank you.

  • #6
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    721
    Thanks
    20
    Thanked 84 Times in 84 Posts
    yes you could use

    PHP Code:
    <?PHP     
        
    if (isset($_POST['pin'])){
            if (
    $_POST['pin'] == '1234'){
            
    header('Location: /yourfile.ext');
            }else{


  •  

    Posting Permissions

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