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 2 of 2

Thread: form and CGI

  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    form and CGI

    take a look at this page:
    http://www.beeweeb.com/download/dlmapper2k.shtml

    I like to do one of them validation forms. that is: the webuser first fills in a form with required fields, and if the form is filled with address and ph and such the user gets to download, but if not -> no download!
    simple?
    I can't figure it out. do I need cgi for this?
    or maybe some more computer awareness...

    /emma

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Brisbane, Australia
    Posts
    181
    Thanks
    1
    Thanked 0 Times in 0 Posts
    yeah you would have to do this with CGI.

    something like this

    Code:
    #!/usr/bin/perl
    
    use CGI qw(param);
    
    $name = param("name");
    $phone = param("phone");
    
    if ((!$name) && (!$phone)) {
     print "You didnt enter the fields required";
    } else {
     print "Location: download.zip"; # the location of the file to be downloaded (dont worry they most likely wont see this)
     open(STORE,"store.txt");
      print STORE "Name: $name\nPhone: $phone\n";
     close(STORE);
    }


  •  

    Posting Permissions

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