473,670 Members | 2,422 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CGI - Accessing form parameters broken

3 New Member
Hello,

I found this site to be very helpful in learning perl, but now I seem to be stumped and wonder if one of experts could assit me with this little problem....

On my web form I have a simple comment form which passes 4 vars to the perl script.

from the script I get mixed up variables (weird) All variables are dumped into the first? Any Ideas what could be the problem.... ? (Using cgi.pm for this....)

____ The Perl Script_______

Expand|Select|Wrap|Line Numbers
  1. #!E:\Perl\bin\perl.exe
  2.     use CGI qw/:standard/;
  3.     use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
  4.     use Net::SMTP; 
  5.     my $in = CGI::new;
  6.  
  7. # Get Vars from htm form
  8. my $Contact_me = $in->param('enable');
  9. my $Employee = $in->param('name');
  10. my $Purposal = $in->param('Purpuse');
  11. my $Comments = $in->param('Wisdom');
  12.  
  13. # message format building phase
  14. $body = "<html><HEAD><TITLE>Post Comment</TITLE></head><body><p>";
  15. $body .= "<font color=blue size=2> Web User wishs to make $Purposal . <br>";
  16. $body .= "Name: $Employee <br>"; 
  17. $body .= "User $Contact_me to be contacted. <br> ";
  18. $body .= " <br> <br> $Comments ";
  19. $body .= "<br>";
  20. $body .= "<font size=1 color=white> $ENV{REMOTE_ADDR} </font><br>";
  21. $body .= "<H6> Have a nice day!! </H6> \n";
  22. $body .= "</BODY></html> \n";   
  23.  
  24. #Test lines begin
  25. print $body;


_____HTML output from the CGI_____

[HTML]Web User wishs to make .
Name: testuser enable=disagree Purpuse=Complai nt Wisdom=test the web
User to be contacted.

Have a nice day!! [/HTML]

Thanks for what help you might have....

e-mail
Feb 15 '07 #1
3 1920
KevinADC
4,059 Recognized Expert Specialist
can we see the html form too?
Feb 15 '07 #2
KevinADC
4,059 Recognized Expert Specialist
We could start with general code clean-up in the mean time:

Expand|Select|Wrap|Line Numbers
  1. #!E:\Perl\bin\perl.exe
  2. use strict;
  3. use warnings;
  4. use diagnostics;
  5. use CGI;
  6. use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
  7. use Net::SMTP;
  8. my $in = CGI->new;
  9. print $in->header(); 
  10. warningsToBrowser(1);
  11. # Get Vars from htm form
  12. my $Contact_me  = $in->param('enable');
  13. my $Employee    = $in->param('name');
  14. my $Purposal    = $in->param('Purpuse');
  15. my $Comments    = $in->param('Wisdom');
  16.  
  17. # message format building phase
  18. my $body = qq~<html><HEAD><TITLE>Post Comment</TITLE></head><body><p>
  19. <font color=blue size=2> Web User wishs to make $Purposal<br>
  20. Name: $Employee <br>
  21. User $Contact_me to be contacted. <br>
  22. <br> <br> $Comments
  23. <br>
  24. <font size=1 color=white> $ENV{REMOTE_ADDR} </font><br>
  25. <H6> Have a nice day!! </H6>
  26. </BODY></html>
  27. ~;   
  28.  
  29. #Test lines begin
  30. print $body;
  31.  
in your code you never printed an http header so the script should not have worked if run as a cgi from a client/server.
Feb 15 '07 #3
Ticool
3 New Member
AS you requested, the html code....


[HTML]
<html>
<head>
<title>FEEDBACK </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
#enterName {
visibility: hidden;
padding-left: 50px;
}
</style>
<script type="text/javascript" src="./SDFJASJF;;DSKFS JDFASJSD;KJAF/form.js"></script>
</head>
<body bgcolor="#EEEEE E"> <center>
<table width=80 border=1 cellspacing=0 cellpadding=0>< tr><td>
<p><font size="6" color=blue><b>< center> Wiser words</b></font><br>
<center> <p><font color=violet size=2><SCRIPT LANGUAGE="JavaS cript">var now = new Date();
var days = new Array('Sunday', 'Monday','Tuesd ay','Wednesday' ,'Thursday','Fr iday','Saturday ');
var months = new Array('January' ,'February','Ma rch','April','M ay','June','Jul y','August','Se ptember','Octob er','November', 'December');
var date = ((now.getDate() <10) ? "0" : "")+ now.getDate();
function fourdigits(numb er) {
return (number < 1000) ? number + 1900 : number;
}
//join
today = days[now.getDay()] + ", " +
months[now.getMonth()] + " " +
date + ", " +
(fourdigits(now .getYear())) ;
document.write( today);</script>
</p>
<hr width="50%" align="center">
<form method="post" enctype="text/plain" action="/cgi/todo.pl" name="enablefor m" onSubmit="retur n disableForm(thi s);">
<table align=center border=0 cellpadding=1 width=30% cellspacing=1>
<td><tr><font size=2 color=green><ce nter>
Do you wish to be contacted? &nbsp; <font size=1.5 color=red>*</font>
<input type="radio" name="enable" value="agree" onclick="agree2 ();">Yes, I wish to be contacted!
<div id="enterName"> Please enter your name: <input type=text id="box" name="name" value=""></div>
<input type="radio" name="enable" value="disagree " onclick="disagr ee();" checked>No, I wish to be anonyous!
<br><br>

<table align=center border=0 cellpadding=0 width=35% cellspacing=1>
<td><tr><center > Purpose: &nbsp; <font size=1.5 color=red>*</font>
</td></tr></table>
<table align=center border=0 cellpadding=1 width=30% cellspacing=1>
<td><tr><center >
<input type="radio" name="Purpuse" value="Complain t"> Complaint<br>
<input type="radio" name="Purpuse" value="Suggesti on" checked> Suggestion
</tr></td></table>
<hr width=50% align="center">
<table align=center border=0 cellpadding=1 width=30% cellspacing=1>
<td><tr><center ><p>Comments: &nbsp; <font size=1.5 color=red>* </font>
</tr></td></table>
<textarea name="Wisdom" cols="60" wrap="ON" rows="10"></textarea>
<p><p>
<table width="50%" border="5" cellpadding="10 ">
<tr>
<td>
<div align="center">
<input type="submit" name="done" value="Send!" onmouseover="go Submit()" onmouseout="thi s.value='Send!' ">
</div>
</td>
<td>
<div align="center"> <center>
<input type="reset" name="Reset" value="Reset">
</div></tr>
</table>
<font color=red><h6>F ields with an * are required!</h6></font>
</form>
</tr></td></table>
</body>
</html>
[/HTML]


I've also added the perl code to the above perl code.....



#Test lines begin
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";
print $body;


I checked a couple of our developer scripts at work and they have these in the code.....

print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n";


Even with them, I still have the variables messed up in the body statement.... Beingthe brain child, I changed the body statments to explude the variables and it still didn't work?


$body = "<html><HEAD><T ITLE>Post Mail</TITLE></head><body><p>" ;
$body .= "<img height\=60 width\=55 src\=\"http\://tuxedo\.capreit \.net/Apps/Documentation/HomeDocumentRep ository\.nsf/logo\.JPG\">\n\ n";
$body .= "<p><P><fon t color=blue size=2> Web User wishs to make " . $Purposal \. ."<br>";
$body .= "Name: " . $Employee . '<br>\n";
$body .= " $Con \n";
$body .= " <br> " . $Comments . '<br>\n";
$body .= "<font size=1 color=white>". $ENV{REMOTE_ADD R} \. . " </font><br>\n";
$body .= "<H6> Have a nice day!! </H6> \n";
$body .= "</BODY></html> \n";
Feb 17 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
19342
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is able to fill that one out just fine. The second form is multipart/form-data. Unfortunately, I haven't been able to fill that out in a way that makes the server happy. I set up a copy of this form at my web site so that I could see exactly what a...
4
1776
by: stjulian | last post by:
I have a stored procedure that is supposed to 1. Increment a counter in Table A via a transaction 2. Use this value as the primary key to add in an address to customers Table B (Referenced as a "DECLARE @CustomerID INT" just after the AS clause) 3. Return the primary key. This works perfectly when being called from Query Analyzer supplying values in an EXEC line, however, accessing it from .ASP (IIS 5.0 on Win2K), the
2
1261
by: Bradley Grant | last post by:
I been trying to write a program to access a COM Component for a while now, with out much success so far. The following is part of the code of my program, and this is the message I get, can anyone see at a glance what I might be missing. Any advice would be appreciated. Method 'USB.Form1.button5_Click(object, System.EventArgs)' does not match delegate 'void
8
4452
by: Christopher Weaver | last post by:
I'm having trouble accessing the value of an output parameter of a stored procedure. The SP looks like this: SET TERM ^ ; CREATE PROCEDURE SP_NEW_TASK RETURNS ( "uidTask" INTEGER) AS begin
1
4517
by: iMedia User | last post by:
I have a site where I want to use the Web form validators in two separate forms on a single page. One form allows existing users to log in while the second one allows new users to register. The problem is that if I use the Web Form validation tags, it treats them all as one form (ie...if someone is trying to use the login form, they get an error saying that they have to enter values in the registration form and vice-versa). Any ideas on...
4
3622
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if possible.. for example..i hav a menu in the parent form named "Administrator" whic has an item "mnuLogIn"..now when i click on login..another child form named "frmLogIn" is displayed..what i want to happen is this: when login form(frmLogIn) is...
1
3316
by: Sandy | last post by:
I am defining a web service to receive data that represents an application form and that returns a message indicating if the application form has been successfully validated or not, listing any errors. I would like to use XPath to define the validation rules that will be executed within the web service. Clearly, to do this my data has to be in XML format. However, I would like my WSDL to describe explicitly the schema of the
1
2002
by: Nestor | last post by:
Hello all, I'm begining in the web services world and I've reading about how to invoke them using javascript from Mozilla browser (version 2.0 in my case). I found a very interesting example here: http://www.mozilla.org/projects/webservices/examples/babelfish-wsdl/index.html The problem I have is this: When I try to adapt the invokation on the
3
5972
by: markliam | last post by:
I have a form with a listview and an edit button named Form1. When the edit button is clicked, a dialog box containing some textboxes should appear and the textboxes should be filled with data from the currently selected listview item. The dialog form is called FormEdit. How do I access the listview object on my main form the dialog form? // The main form, in a file called Form1.cs... contains the listview and the edit button
0
8384
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8901
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8813
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7412
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6212
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5683
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2799
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1791
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.