Form user has to complete, prior to access to download

Discussion in 'PHP' started by bowdeni, Sep 3, 2008.

  1. #1
    Hi all

    I'm ok with HTML/CSS to a level I am satisfied, but I am not familiar with PHP. I've read the W3school introductions, and have decided I don't want to dip my feet in the water too much but I'm hoping someone will be able to point me in the right direction.

    The company that I work for currently have brochures available on their website. They would like to know a little more about those who download these brochures, and have requested that there is a level of data collection before the user is granted access to the file.

    Thus I am in need of a solution to such a problem. I assume that they way to do this would be PHP. Should I be using a 'script' or is there a tutorial that would teach me how to code this?

    Thanks in advance!
     
    bowdeni, Sep 3, 2008 IP
  2. WeedGrinch

    WeedGrinch Active Member

    Messages:
    1,236
    Likes Received:
    73
    Best Answers:
    0
    Trophy Points:
    90
    #2
    <?php
    if($_POST['name']=="")
    {
    echo "You must go back and fill in the name form.";
    die ();
    }
    
    /* Repeat above for all fields of information you want, example above used name. */
    
    
    else
    {
    /* Here you need to store the info in a text file, or database, (not going to explain that, i only have 15 minutes xD, google, or make a new post if you need help on storing information in a DB */
    
    echo "<html><iframe src=\"LOCATIONTOYOURFILETHEYCANDOWNLOAD\"></iframe></html>";
    
    /* Above code makes an iframe, and will popup the downloadable file. */
    }
    
    ?>
    
    
    
    Code (markup):
    You said you knew HTML, so I'm assuming that you know how to make an HTML form, that will match up the $_POST variable names. like: $_POST['name']

    I hope that made sense xD, if you need more help or want me to code the full thing for you, send me a PM
     
    WeedGrinch, Sep 6, 2008 IP