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 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    chaoticrealities.com
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile form info needed please

    how do i get this to save the data to a text file please =

    Code:
    use CGI;
    
    $q = new CGI;
    
    print $q->header;
    
    if ($q->param()) {
       print $q->start_html("Results");
       print $q->h2("Results");
       print "Here's what you entered:<p>\n";
       print "Your Name: ", $q->param("name"),$q->br;
       print "Email: ", $q->param("email"),$q->br;
    } else {
       $q->start_html("Post Form");
    }
    
    print $q->start_form(-action=>"test.cgi");
    print "<pre>\n";
    print "     Your Name: ",$q->textfield(-name=>"name"), "\n";
    print " Email address: ",$q->textfield(-name=>"email"), "\n";
    print "</pre>\n";
    
    print $q->submit(-value=>"Send"),
    $q->reset(-value=>"Clear Form");
    $q->end_form;
    
    $q->end_html;

  • #2
    New Coder
    Join Date
    Jun 2002
    Location
    Sydney, NSW, Australia
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Something along the lines of:

    Code:
    open(TXT,'>/path/to/file.txt') or die $!;
    print TXT $q->param("name") . "\n" . $q->param("email");
    close(TXT);
    Should do the trick.

    - Mark

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    chaoticrealities.com
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks dude


  •  

    Posting Permissions

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