Basic cgi help on Apache (winXP)

  • bentreflection
  • Born
  • Born
  • bentreflection
  • Posts: 4

Post 3+ Months Ago

I want to add a form to my site that takes a Name, Email Address, and Comments variables and send them to my emailForm.cgi script. The script is supposed to add onto a log called email.txt and just post the information so i can read it later. However, when i submit the data from the .html file, it adds only the stuff I hardcoded in, leaving blank spaces for all the $variables. Anyone know what I am doing wrong? My only idea is that I am using the http:// path to the cgi script, not the C:/ path, because when i do that it doesn't execute, just displays the script. Thanks for any help!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Welcome to OZZU bentreflection. I think you've explained your problem well enough, but without seeing the code you are using, I doubt anyone will be able to help you much. Did you write this yourself? or is it a script you found elsewhere? If you wrote it yourself, you'll probably need to paste the majority of your CGI script (if not all of it -- or if it's overly large provide a link to the text version of it) and also the form code you are using.
  • bentreflection
  • Born
  • Born
  • bentreflection
  • Posts: 4

Post 3+ Months Ago

here is my form emailFormNew.html stored in realDocs in my apache folder
Code: [ Select ]
<html>
<head>
<title>
AndySchmidt.tk
</title>
</head>

<body bgcolor="000000" bgproperties="fixed" text="#9E0606" link="#CE0000" alink="#CE0000" vlink="#CE0000">
<center><h2>Email Andy</center></h2><h3>
<form action="http://68.110.9.56:8000/cgi-bin/form_mailer.cgi" method="post" enctype="text/plain">
<table><tr><td>
<P><b>Your Name:
<P><INPUT NAME="name" TYPE="text" SIZE=30 MAXLENGTH=50><BR>
<br>
<P><b>Your Email:
<P><INPUT NAME="email" TYPE="text" SIZE=30 MAXLENGTH=50><BR>
<br>
<P>What you want to whine about:
<P><TEXTAREA NAME="comments" ROWS=10 COLS=40></TEXTAREA><BR>
<center><INPUT TYPE="submit" value="Send That *plum*">


</td></tr>

</FORM>
</body>
</HTML>
  1. <html>
  2. <head>
  3. <title>
  4. AndySchmidt.tk
  5. </title>
  6. </head>
  7. <body bgcolor="000000" bgproperties="fixed" text="#9E0606" link="#CE0000" alink="#CE0000" vlink="#CE0000">
  8. <center><h2>Email Andy</center></h2><h3>
  9. <form action="http://68.110.9.56:8000/cgi-bin/form_mailer.cgi" method="post" enctype="text/plain">
  10. <table><tr><td>
  11. <P><b>Your Name:
  12. <P><INPUT NAME="name" TYPE="text" SIZE=30 MAXLENGTH=50><BR>
  13. <br>
  14. <P><b>Your Email:
  15. <P><INPUT NAME="email" TYPE="text" SIZE=30 MAXLENGTH=50><BR>
  16. <br>
  17. <P>What you want to whine about:
  18. <P><TEXTAREA NAME="comments" ROWS=10 COLS=40></TEXTAREA><BR>
  19. <center><INPUT TYPE="submit" value="Send That *plum*">
  20. </td></tr>
  21. </FORM>
  22. </body>
  23. </HTML>



and here is my form_mailer.cgi, stored in the cgi-bin in apache


Code: [ Select ]
#!/perl/bin/perl -wT
use CGI;

my $query = new CGI;

print $query->header ( );

my $name = $query->param("name");
my $email = $query->param("email");
my $comments = $query->param("comments");

open EMAIL, ">>email.txt";

print EMAIL "From: $name\n";
print EMAIL "At: $email\n";
print EMAIL "To: werallmadhere\@hotmail.com\n";
print EMAIL "Subject: AndySchmidt.tk\n\n";
print EMAIL "$comments\n";
print EMAIL "\n.\n";
close ( EMAIL );


print <<END_HTML;
<html>
<head></head>
<body>Thanks for filling in our form!</body>
</html>
END_HTML
  1. #!/perl/bin/perl -wT
  2. use CGI;
  3. my $query = new CGI;
  4. print $query->header ( );
  5. my $name = $query->param("name");
  6. my $email = $query->param("email");
  7. my $comments = $query->param("comments");
  8. open EMAIL, ">>email.txt";
  9. print EMAIL "From: $name\n";
  10. print EMAIL "At: $email\n";
  11. print EMAIL "To: werallmadhere\@hotmail.com\n";
  12. print EMAIL "Subject: AndySchmidt.tk\n\n";
  13. print EMAIL "$comments\n";
  14. print EMAIL "\n.\n";
  15. close ( EMAIL );
  16. print <<END_HTML;
  17. <html>
  18. <head></head>
  19. <body>Thanks for filling in our form!</body>
  20. </html>
  21. END_HTML

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: Liamw411 and 39 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.