Forum Home
Press F1
 
Thread ID: 50800 2004-11-02 03:01:00 Does any one here know CGI/Perl? (ASAP) stu120404 (268) Press F1
Post ID Timestamp Content User
286930 2004-11-02 03:01:00 Hello :)

Does any one here know CGI/Perl?

If you do:

How do you get checkbox's to show up on a mail script?

Here is some of the HTML Page which has the checkbox's on it:

<td height="20" colspan=4 bgcolor="#FFCC00" class=main><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">What can you offer for security? </font></td>
</tr>
<tr>
<td></td>
<td colspan="3" class=main style18> <span class="style22"><span class="style28">
<input name="offerforsecurity?" type="checkbox" id="offerforsecurity?" value="Car">
Car </span>

<input name="offerforsecurity?" type="checkbox" id="offerforsecurity?" value="Home">
Home

</span><span class="style28">
<input name="offerforsecurity?" type="checkbox" id="offerforsecurity?" value="Guarantor">
Guarantor

</span><font size="2" face="Verdana, Arial, Helvetica, sans-serif" > </font><font size="2" face="Verdana, Arial, Helvetica, sans-serif" > </font></td>
</tr>
<tr bgcolor="#FFFFCC">
<td colspan=4 class=main></td>
</tr>
<tr bgcolor="#FFCC00">
<td colspan=4 class=main><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">How
would you rate your credit history? </font></td>
</tr>
<tr>
<td width="99"><font size="2" face="Verdana, Arial, Helvetica, sans-serif" > </font></td>
<td class=main colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif" >

<input
name=rateyourcredit type=radio value=Excellent>
Excellent
<input
name=rateyourcredit type=radio value=Average>
Average</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif" >
<input
name=rateyourcredit type=radio value=Poor>
Poor </font></td>
</tr>
<tr>
<td class=main colspan=4></td>
</tr>
<tr bgcolor="#FFCC00">
<td colspan=4 class=main><font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">How would you rate your partners' credit history? </font></td>
</tr>
<tr>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif" > </font></td>
<td class=main colspan="3"><font size="2" face="Verdana, Arial, Helvetica, sans-serif" >
<input
name=rateyourpartnerscredit type=radio value=Excellent>
Excellent
<input
name=rateyourpartnerscredit type=radio value=Average>
Average</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif" >
<input
name=rateyourpartnerscredit type=radio value=Poor>
Poor </font></td>
</tr>

Here is the CGI/perl script I am using:

#!/usr/local/bin/perl

$mailprog = '/usr/sbin/sendmail';
$sendto = 'myemailaddress@somehost.co.nz';
$corref = 'www.refinanceline.co.nz

if (!$ENV{'HTTP_REFERER'}) {
&invref;
} else {
if ($ENV{'HTTP_REFERER'} =~ /$corref/) {
&sendmail;
} else {
&invref;
}}

sub invref {
print "Content-type: text/html\n\n";
print "Error : Invalid referrer";
}

sub sendmail {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$form{$name} = $value; }
open(MAIL,"|$mailprog -t");
print MAIL "To: $sendto\n";
print MAIL "From: $form{'email'} ($form{'name'})\n";
print MAIL "Subject: $form{'subject'}\n\n";
print MAIL "name: $form{'name'}\n\n";
print MAIL "address: $form{'address'}\n\n";
print MAIL "phone: ($form{'areacode'}) $form{'phoneno'}\n\n";
print MAIL "e-mail: $form{'email'}\n\n";
print MAIL "borrow_amount: $form{'borrowamount'}\n\n";
print MAIL "IP Address: $ENV{'REMOTE_ADDR'}\n";
print MAIL "Remote Host: $ENV{'REMOTE_HOST'}\n";
print MAIL "User Agent: $ENV{'HTTP_USER_AGENT'}\n";
close (MAIL);
print "Location: $form{'redirect'}\n\n";
}

What do I add for checkbox's to show up? Do I add?
print MAIL "somethinghere: $form{'somevaluehere'}\n\n";

Or something like that?

If you have any question just ask :)

Please help me ASAP! (& this is my first time using CGI/Perl)
stu120404 (268)
286931 2004-11-02 04:27:00 ** bump ** stu120404 (268)
286932 2004-11-02 06:33:00 +1 postcount.

Bumping other threads after short period is annoying, bumping your own after an hour and a half is just plain stupid.
whtafo (156)
286933 2004-11-02 07:09:00 His problem is still unanswered. It was posted 4 hours and 6 minutes ago. If he had not bumped it, it would probably have disappeared by now.

> bumping your own after an hour and a half is just plain stupid

Telling somebody else off for bumping instead of helping them is worse.

Now Stu, I don't know CGI or Perl, but how important is it to be in perl? IE. how much work would a conversion to ASP (which I know) take?

George
george12 (7)
286934 2004-11-02 08:43:00 > bumping your own after an hour and a half is just
> plain stupid.

Dont you know what ASAP means whtafo?!?!
stu120404 (268)
286935 2004-11-02 08:48:00 Hello George

Thank you for your reply :) (See whtafo if you stop mooning about things & help people with there problem then you will get thanked, but if you don’t you get a un nice post like the above)

> Now Stu, I don't know CGI or Perl, but how important
> is it to be in perl? IE. how much work would a
> conversion to ASP (which I know) take?

Ah, there is a problem, The reason why I am using Perl Not PHP( I would use php in this case) but because the server this site is on does Not support PHP/ASP, I cant use it & it only has a cgi-bin, so I can only use cgi scripts here

So you can see how important for me to use Perl.

Does any one know Perl? ( I really need an answer by 10:30 pm)
stu120404 (268)
286936 2004-11-02 10:30:00 Hi stu

Check this (www.scriptarchive.com) out
Rob99 (151)
286937 2004-11-02 10:50:00 > Dont you know what ASAP means whtafo?!?!

Oh no! Please enlighten me - common anagrams are a constant struggle.

> Thank you for your reply :) (See whtafo if you stop
> mooning about things & help people with there problem
> then you will get thanked, but if you don’t you get a
> un nice post like the above)

As much as I'm sure you'd like it, there was no mooning going on. My pants remained fastened throughout the post.

Obviously you are rushing this to meet a deadline that you can't make - no need to take that out on the people here by relentlessly bumping a thread. If people knew the answer, they would post - they don't need it repeatedly launched in their face.

Incidentally I could've answered this long ago, but sometimes sharing knowledge isn't nearly as fun.
whtafo (156)
286938 2004-11-02 11:05:00 Why don't you just try adding what you thought it was and test it?

print MAIL "Field Title: $form{'inputname'}\n\n";

i.e.:

print MAIL "My Partners Credit is: $form{'rateyourpartnerscredit'}\n\n";

That should be all you need to do, though it's over dramatised as it is. Most standard form2mails will just take whatever you throw at them and parse it out with the input name and the inputted value without having to manually specify everything.

Test it with your own e-mail address and submit the hell out of it - not going to hurt anyone.

Looking at the code it should logically break down and match up like all the other fields did already.

The 'offerforsecurity?' one may not work - the ? is likely to be a hassle.

Test it though, you're not going to maim/mutilate anyone/thing by fudging a couple of perl scripts.
whtafo (156)
286939 2004-11-02 12:53:00 I've not used Perl in a while but I think you need something along the lines of

@offerforsecurity = param("offerforsecurity");
for $i (@offerforsecurity)
{
print MAIL "Offer For Security: $i\n\n";
}

I would really need to test it, but this is close to what I can recall. Ask along the lines of PHP and I would be definitely able to help.


KK
Kame (312)
1 2 3 4