HELP! I'm pretty sure it doesn't work because I need to submit the form with the hidden fields rather than just redirect the page. Can I submit that automatically and skip the redirect? I don't want the user to have to click anything, this should happen behind the scenes.#!/usr/local/bin/perl5.005 use lib '../lib'; use strict; use CGI qw(:standard); my $query = new CGI; #Grab the evaluation responses from the form my $cdsid = $query->param('cdsid'); my $title = $query->param('Title'); my $author = $query->param('Author'); my $book_review = $query->param('book_review'); my $post_review = $query->param('post_review'); my $use_name = $query->param('use_name'); my $sendmail = '/usr/lib/sendmail'; my $recipient = 'mbelang3@ford.com'; my $sender = 'e-Books Feedback <plskills@ford.com>'; my $site_name = 'e-Courses'; my $site_url = '../e-course.html'; my $site_name2 = 'e-Books'; my $site_url2 = '../e-books.html'; my $value; my $field; my $email; my $name; my $mail_body = ''; print "Content-type: text/html\n\n"; print <<"eof"; <input type=hidden2 name="cdsid" value="$cdsid"> <input type=hidden2 name="title" value="$title"> <input type=hidden2 name="author" value="$author"> <input type=hidden2 name="book_review" value="$book_review"> <input type=hidden2 name="post_review" value="$post_review"> <input type=hidden2 name="use_name" value="$use_name"> eof foreach $field (sort ($query->param)) { foreach $value ($query->param($field)) { $mail_body .= "$field: $value\n"; } } if (($email = $query->param('07_email')) and ($query->param('07_email') =~ /@/)) { if ($name = $query->param('cdsid')) { $name =~ s/"//g; $sender = "\"$name\" <$email>"; } else { $sender = "$email"; } } open(MAIL, "|$sendmail -oi -t") or die "Can't open pipe to $sendmail: +$!\n"; print MAIL "To: $recipient\n"; print MAIL "From: $sender\n"; print MAIL "Subject: e-Books Feedback\n\n"; print MAIL "$mail_body"; close(MAIL) or die "Can't close pipe to $sendmail: $!\n"; print "<html><body>" "<script language='JavaScript'>". "window.location='http://wwwdev.pl.ford.com/L2e/cgi-bin/ebo +ok_insert_2.cgi'". "</script></body></html>"; </pre> Which sends you to the second script: <pre> #!/usr/local/bin/perl5.005 use lib '../lib'; use DBI(0.90); use strict; use Database; use CGI qw(:standard); Database::->db_info_path("../lib/db.cfg"); my $dbh = new Database; #Grab the evaluation responses from the form my $cdsid = param('cdsid'); my $title = param('title'); my $author = param('author'); my $book_review = param('book_review'); my $post_review = param('post_review'); my $use_name = param('use_name'); print "Content-type: text/html\n\n"; #Declare variables for insertion constants my $plselect = "u"; my $updt = "L2e Init"; #Insert the e-Book review and book information into il2e009_bk_review if ($book_review) { my %review = ('il2e009_book_title_x' => $title, 'il2e009_book_author_x' => $author, 'il2e009_eval_cds_id_c' => $cdsid, 'il2e009_pl_select_f' => $plselect, 'il2e009_post_rev_f' => $post_review, 'il2e009_post_name_f' => $use_name, 'il2e009_review_x' => $book_review, 'il2e009_last_updt_c' => $updt ); foreach my $key (keys %review) { print "$key = $review{$key}\n"; } print "Attempting insert....\n"; $dbh->insert_row('il2e009_bk_review',\%review); } print $cdsid; $dbh->disconnect;
In reply to Trouble passing values through hidden fields by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |