Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Location
    Malaysia
    Posts
    29

    Unhappy Unanswered: how to combine birthday into one single field in database ?

    i have set up a three drop down list for birthdate, birth month, and birth year in a html form. But I have difficulty in passing these three parameters into the cgi script and database. The cgi script seems to capture the birthday into the database, but not the birth month and birth year. How can I combine these three birthdate, birth month, and birth year into a dob field in a database ?

  2. #2
    Join Date
    Jan 2004
    Location
    Germany
    Posts
    167
    You have to concatenate these information before you store the data into the database:
    Code:
    #! /usr/bin/perl
    
    use strict;
    use CGI;
    use CGI::Carp qw(fatalsToBrowser);
    
    my $cgi = CGI->new();
    print $cgi->header(-type => 'text/html');
    
    my %params = $cgi->Vars();
    
    my $birthday = $params{bday}."-".$params{bmonth}."-".$params{byear};
    
    print "Your birthday is on ",$birthday,", isn't it?<br />";
    The drop-down list for the birthday are named in this example 'bday','bmonth' and 'byear'... You have to adapt this on your script.
    board.perl-community.de - The German Perl-Community

Posting Permissions

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