in reply to Multi-line input fields

OK -- We're getting close. See what you think? One of the problems still reamaining is escaping "@" in email address. If anyone insterested this is a little c.y.a script I'm creating to track server outages . Thanks again David
#!/usr/bin/perl -w use strict; use DBI; my ($dbh,$sth,@row,$server,$date,$date_closed,$contact,$contact_email, +$contact_phone,$planned,$event,$resolution); print "Enter sever name: "; $server=<STDIN>; chomp($server); print "Enter Date (YYYY/MM/DD): ";$date=<STDIN>;chomp($date); print "Date Closed(YYYY/MM/DD): ";$date_closed=<STDIN>;chomp($date_clo +sed); print "Contact: ";$contact=<STDIN>;chomp($contact); #print "Contact Email: ";$contact_email=<STDIN>;chomp($contact_email); print "Contact Phone: ";$contact_phone=<STDIN>;chomp($contact_phone); print "Planned Event(yes/no): ";$planned=<STDIN>;chomp($planned); ###################################################################### +###### # Define multi-line fields $/ = "^A"; print "Describe Event:\n"; $event=<STDIN>;chomp($event); print "\n"; print "Describe Resolution:\n"; $resolution=<STDIN>;chomp($resolution); ###################################################################### +######## $dbh = DBI->connect("dbi:mysql:sirinfo","rca","rcaS7ay0u7") or die "Nice try buckaroo\n"; $sth = $dbh->prepare("INSERT INTO rca(server,date,date_closed, contact,contact_phone,planned,event,resolution VALUES('$server','$date','$date_closed','$contact +','$contact_phone','$planned','$event','$resoluti on')") or die "No cigar\n"; $sth->execute(); $dbh->disconnect(); exit;

Replies are listed 'Best First'.
Re: Followup: Multi-line input fields
by tachyon (Chancellor) on Oct 25, 2001 at 16:52 UTC

    You should *really* be using placeholders with DBI. Really. See Tricks with DBI for links to why. At the least you need to escape your strings. You can also do this which is a shorter idiom when getting input:

    chomp(my input = <STDIN>); # get input and remove newline

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print