FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


perl help... script almost working... please help..





Slick
hi im creating a form on a site... and have almost completed it now...

the form process is working.. i.e. once filled out and submitted the form is sent and recieved in my inbox etc but the actual data in the form fields is not present...

so all i recieve is

Email:
Name:

etc none of the actual inputed data... can some one please tell me wat to add to print the inputted data... thank ypu code to follow...

form on the site is

Code:
<form method="POST" action="/cgi-bin/contact.pl">
<div align="left"><strong>Fields marked (*) are required
 
</strong></div>
<p align="left"><strong>Email:* </strong><br>
<input type="text" name="EmailFrom">
<p align="left"><strong>Contact Name:</strong><br>
<input type="text" name="ContactName">
<p align="left"><strong>Telephone:</strong><br>
<input type="text" name="Telephone">
<p align="left"><strong>Job Title:</strong><br>
<input type="text" name="JobTitle">
<p align="left"><strong>Web Address:</strong><br>
<input type="text" name="WebAddress">
<p align="left"><strong>Country:</strong><br>
<input type="text" name="Country">
<p align="left"><strong>Description of Requirements:</strong><br>
<textarea name="DescriptionofRequirements"></textarea>
<p align="left">
  <input type="reset" name="Reset" value="Reset">
  <input type="submit" name="submit" value="Submit">
                              </form>


code in the perl file is

Code:
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
print "Content-type: text/html \n\n";

# get posted data into local variables
$input = new CGI;
$EmailFrom = $input->param('EmailFrom');
$EmailTo = "djhicks\@djhicks.co.uk";
$Subject = "Enquiry Form";
$wdwd = $input->param('wdwd');

# validation
$validationOK=true;
if ($EmailFrom eq '') {$validationOK=false;}
if ($validationOK eq false) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

# prepare email body text
$Body .= "Contact Name: ";
$Body .= "$ContactName";
$Body .= "\n";
$Body .= "Telephone: ";
$Body .= "$Telephone";
$Body .= "\n";
$Body .= "Job Title: ";
$Body .= "$JobTitle";
$Body .= "\n";
$Body .= "Web Address: ";
$Body .= "$WebAddress";
$Body .= "\n";
$Body .= "Country: ";
$Body .= "$Country";
$Body .= "\n";
$Body .= "Description of Requirements: ";
$Body .= "$DescriptionofRequirements";
$Body .= "\n";

# send email
$mailprog = '/usr/sbin/sendmail -t';
open(MAIL,"|$mailprog");
print MAIL "To: $EmailTo\n";
print MAIL "From: $EmailFrom\n";
print MAIL "Subject: $Subject\n\n";
print MAIL $Body;
close(MAIL);

# redirect to success page
print "<meta http-equiv=\"refresh\" content=\"0;URL=success.html\">";


thanks to all that can help!
Aredon
The following are all undefined:
$ContactName
$Telephone
$JobTitle
$WebAddress
$Country
$DescriptionofRequirements

You had the right idea with:
$wdwd = $input->param('wdwd');

Code:

$ContactName = $input->param('ContactName');
$Telephone = $input->param('Telephone');
$JobTitle = $input->param('JobTitle');
$WebAddress = $input->param('WebAddress');
$Country = $input->param('Country');
$DescriptionofRequirements = $input->param('DescriptionofRequirements');


I haven't tested your code so there may still be errors in the code somewhere.
Then-again it could be that I have already found all the errors that needed to be found.
For learning purposes, you may also want to read the CGI module on cpan.
Slick
sweet - cheers for ur help inserted the code under wdwd lol and now works a treat!


boooooooooo!!!!!!!!!

thank you!
Related topics
help me plzzz
PLEASE HELP SUPPORT THIS SPORTING PROJECT
Help, I need LWP::Simple perl module!!
Hot Or Not script not working
Can you help me.. please..
Database Privilege
Script not working
I am going to need a lot of help***** PLEASE CLOSE**********
Add function for link page
Sending simple emails using PERL - Help required
VERY URGENT! Please Help Me!
My website is attacked(?)
Executing a Perl CGI script
HELLO PLEASE HELP
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.