Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Callig a script with a variable

Status
Not open for further replies.

MarkRobinson

Programmer
Feb 18, 2000
112
US
Need to create a script:
1 - Click a button on an html page that sends the <page title tag> to a form
2 - On the form I need to print the <page title tag> and ask for the users name and email. Then Click Submit
3a - I need to send a confirmation email with the title tag and the name.
3b - Need to call a url (the confirmation page)

I'm a little bit lost on how to do this - can anyone give me some guideance?
 
This code was written by someone trying to help -- I think It's more complicated than it needs to be.

Testform1 needs to send its title to a page where the user enters his email and checks a mandatory box.
An email is then sent to the person who filled in the form and me with the original title tag... then calls a URL (for a Google Checkout Page).



Testform1.html - Needs to send Title Tag to MyScript5.pl
--------------------------------------------------------
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Japanese Women Bowing</title>
</head>
<body>
<div align="center">
<p><img src="Japanese women bowing.jpg" width="150" height="231" /></p>
<form id="testform1" name="testform1" method="post" action=" <label for="Submit"></label>
<h2>Japanese women bowing in traditional greeting </h2>
<p><input name="Japanese Women Bowling" type="hidden" value="title" />
&nbsp;</p>
<p>
<input type="submit" name="Buy Now" value="Buy Now" id="Buy Now" />
</p>
</form>
<p><br />
</p>
</div>
</body>
</html>
------------------------------------------------------------------------
Perl Script
------------------------------------------------------------------------
!/usr/local/bin/perl
$our_title = "myscript5";
$action = "use CGI ":all";
$my_CGI_query = CGI::new(); # create a new CGI object
print $my_CGI_query->start_html(
-title => $title,
-bgcolor => "#FFFFFF");

print "<CENTER>\n";
print "</CENTER>";
print $my_CGI_query->startform(
-name => "FORM",
-method => 'POST',
-action => $action #action defined at top
);
print $my_CGI_query->radio_group(
-name=>"radio_action",
-values=>['Yes'],
-default=>'Yes'
);
print $my_CGI_query->hidden(
-name=>"hidden",
-values=>['title'],
-default=>'$title'
);
print br,
"I have read and agree to the terms and conditions",
"described in the agreement",
br;
print "Name: " ,
$my_CGI_query->textfield(-name=>'name'),
br,
"Email: &nbsp; ",
$my_CGI_query->textfield(-name=>'email'),
br;
"Title: ",
$my_CGI_query->hidden(-name=>'title'),
br;
print $my_CGI_query->submit(
-name => "Continue",
);
print $my_CGI_query->endform();
print $my_CGI_query->end_html();
__DATA__
use CGI ":all";
$my_CGI_query = CGI::new(); # create a new CGI object
$AcceptedAgreement = 1 if ($my_CGI_query->param('radio_group') eq 'Yes');
if (!$AcceptedAgreement) #agreement was *not* accepted!
{
#do stuff in here for the case where they did not accept the agreement
#like for example, exit(0); or redirect to another page
}
$customer_email = $my_CGI_query->param('email');
open (MESSAGE,"| /usr/sbin/sendmail -t");
print MESSAGE "To: $customer_email\n";
print MESSAGE "BCC: abourne5780\@comcast.net\n";
print MESSAGE "From: no-reply@handicappedpets.com\n";
print MESSAGE "Subject: Feedback from Japanese Women Bowing \n\n";
close (MESSAGE);
thank_you(); #method call
}
sub thank_you {
print <<EndStart;
<html>
<head>
<title>Thank You</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<h1>Thank You</h1>
<hr>
EndStart
print "<blockquote><em>$FORM{comment}</em></blockquote>\n\n";
print <<EndHTML;
</body>
</html>
EndHTML
}
----------------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top