PDA

View Full Version : Im in a need for a form...


Bashh
08-19-2002, 11:22 PM
Well, i gots the form down pact, but i need to know some cgi for it to work (so i was told) any help please?


<html>
<head>
<form action="?" method="post" subject="Character">

<input type="text" name="thebox" align="top" maxlength="25" size="40"><br>

<input type="submit" value="Send" align="middle">

</form>
</head>
</html>


this is what i have. (?)= Im not sure what to put. if i put mailto:my_email@hotmail.com when i test it in a browser a damn popup comes up asking if i want to send it, because it uses email, and has never worked for me even after hiting ok... urg some help would be very thoughtful. thanks

andy7t
08-20-2002, 11:50 AM
I assue your trying to send an email to yourself. (Correct?)
Well what you need to do is make a cgi script that uses sendmail to send the email to you.
So:

In your form box (your wrote) you need to have <form action=thisfile.cgi method=post>

Now in thisfile.cgi:

#!/usr/bin/perl

read(STDIN,$indata,$ENV{'CONTENT_LENGTH'});
@indata = split(/&/,$indata);
foreach $i (0..$#indata)
{$indata[$i] =~ s/\+/ /g;
($key,$val) = split(/=/,$indata[$i],2);
$key =~ s/%(..)/pack("c",hex($1))/ge;
$val =~ s/%(..)/pack("c",hex($1))/ge;
$indata{$key} .= "\0" if (defined($indata{$key}));
$indata{$key} .= $val;
}
$MailProgram = '/usr/sbin/sendmail';
#CHECK YOUR ADMIN FOR YOUR SENDMAIL PATH #USUALLY /usr/sbin/sendmail
$YourEmail = "you@you.com";


open (MAIL,"|$MailProgram -t -f \"$YourEmail\"");
print MAIL "To: you@you.com\n";
print MAIL "From: Someone on your Message Form\n";
print MAIL "Subject: Message Contact\n";
print MAIL "$indata{'thebox'}\n";

----END----

The $indata command is what has been submitted.
If you need any more help, please contact me at
info@warzone-game.co.uk