FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.

FutureQuest, Inc.
Go Back   FutureQuest Community > General Site Owner Support (All may read/respond) > PHP, Perl, Python and/or MySQL
User Name
Password  Lost PW

Reply
 
Thread Tools Search this Thread Display Modes
Old 10-10-2002, 05:41 PM   Postid: 74839
instruction
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Oct 2002
Posts: 26
perl--> How do I take the input from a form that is now in a script and send it to...

I have a form that uses method = POST. Once the user hits the "submit" button I have a script that checks the data for accuracy. However after I check the users input I want to send the data to a cgiemail script. HOW DO I send the the original input (that came in the STDIN) to the next form? thank you for helping if you can.

Last edited by instruction : 10-10-2002 at 06:03 PM.
instruction is offline   Reply With Quote
Old 10-10-2002, 06:47 PM   Postid: 74841
sheila
Site Owner
 
sheila's Avatar

Forum Notability:
0 pts: Even-handed
[Post Feedback]
 
Join Date: Aug 1999
Location: Metro Los Angeles Area
Posts: 7,398
This looks like it might have a clue:

http://www.experts-exchange.com/Prog..._20145281.html

Good luck!

-- google is my best friend!
__________________
sheila
http://www.thinkspot.net/sheilaruns/
sheila is offline   Reply With Quote
Old 10-10-2002, 06:50 PM   Postid: 74842
sheila
Site Owner
 
sheila's Avatar

Forum Notability:
0 pts: Even-handed
[Post Feedback]
 
Join Date: Aug 1999
Location: Metro Los Angeles Area
Posts: 7,398
But wait! There's more!

http://discuss.cgi101.com/cgi101/article.cgi?8335

http://www.ku.edu/~acs/docs/other/fo....shtml#target8

__________________
sheila
http://www.thinkspot.net/sheilaruns/
sheila is offline   Reply With Quote
Old 10-12-2002, 08:44 AM   Postid: 74953
instruction
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Oct 2002
Posts: 26
thank you, but..

Shiela,

Thank you for the links. They tought me some things I did not know, and I appreciate that. However the examples given in those tutorials, assume that you know the "VALUE" of the variables. For instance say you assigned the variable name --> f_name to the "what is your first name:" field of a form. When the user types in whate there name is, I nor my program know what the value of f_name is: Well I do, but the examples all use literal strings, so You can not put something like:


f_name => '$form{\'required-f_name\'}';

That is not literal. So how would I get the literal string---> say they typed:

freddy. <---how do you get your program to come up with the literal string rather then haveing it assigned to a variable?

Any ideas? This probably made no since, and if it doesn't I am sorry.
instruction is offline   Reply With Quote
Old 10-12-2002, 10:40 AM   Postid: 74956
sheila
Site Owner
 
sheila's Avatar

Forum Notability:
0 pts: Even-handed
[Post Feedback]
 
Join Date: Aug 1999
Location: Metro Los Angeles Area
Posts: 7,398
Re: thank you, but..

Quote:
Originally posted by instruction:
However the examples given in those tutorials, assume that you know the "VALUE" of the variables. For instance say you assigned the variable name --> f_name to the "what is your first name:" field of a form. When the user types in whate there name is, I nor my program know what the value of f_name is: Well I do, but the examples all use literal strings, so You can not put something like:


f_name => '$form{\'required-f_name\'}';

That is not literal. So how would I get the literal string---> say they typed:

freddy. <---how do you get your program to come up with the literal string rather then haveing it assigned to a variable?

Any ideas? This probably made no since, and if it doesn't I am sorry.
k, let me answer your question with a question.

Doesn't your verification script know the key/value pairs for the data submitted by the form? For example

required-f_name = freddy

right?

Isn't "required-f_name" the name in the form for the field where they enter the first name, and the value entered would be something like "freddy"?

But you are saying, if I understand you correctly, that you don't know "freddy"? Then I don't understand how you are validating the data with the previous step? How can the validation script do it's thing if it only has $form{\'required-f_name\'} instead of "freddy" ?

This is the information you need to pass to cgiemail after you've validated the data?

So, it looks to me, from the lwpcookbook (linked from one of the references above) that once you've validated the data, your validation script could pass it on to cgiemail as follows:
(see the section on POST in the lwpcookbook)

Code:
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
$ua = LWP::UserAgent->new;  
   my $req = POST 'http://www.yourdomain.com/cgi-bin/cgiemail/template.txt',
                [ required-f_name => 'freddy', required-l_name => 'smith' ];  
    print $ua->request($req)->as_string;
I'm not sure, but maybe this would work also (I would think so?):

Code:
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
$ua = LWP::UserAgent->new;  
   my $req = POST 'http://www.yourdomain.com/cgi-bin/cgiemail/template.txt',
   [ required-f_name => $form{\'required-f_name\'}, 
   required-l_name => $form{\'required-l_name\'} ];  
   print $ua->request($req)->as_string;
I can't see why the above wouldn't work, in the case that you don't know the actual values from the form. However, I won't be testing it for you, as I don't program in Perl. (Mostly use Python at the moment.) Anyhow, I hope the above is right. I would suggest testing it out and seeing what happens. Or, maybe some of the Perl experts will come in here and double-check/verify the above. I'm really more comfortable discussing Python. (I already looked to see that Python can also do this, see http://www.python.org/doc/current/li...e-urllib2.html . So, I have learned something useful for me, as well. )

[edit: I know I have made syntax errors in the above with misplaced quote marks, or not escaping certain characters. I think the meaning is clear though? I'm loathe to try and do much correcting, since I'm not really sure of the correct syntax anyhow.]
__________________
sheila
http://www.thinkspot.net/sheilaruns/
sheila is offline   Reply With Quote
Old 10-12-2002, 11:13 AM   Postid: 74957
instruction
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Oct 2002
Posts: 26
ok now look at this

starting where you wrote:

required-f_name = freddy


yes my verification script know the value. However what is not possable is this:


[ required-f_name => 'freddy', required-l_name => 'smith' ]
nor this:
required-f_name => $form{'required-f_name'}

the first one assumes that I am there to tell the script the name--well I wont be there when they fill out the form.

the second will literaly send --> $form{'required-f_name'} rather then the value it represents. See that is where the problem is! Whatever comes after the => is literal---in other words will be printed (or sent) as is!

See what I can not figure out is this:

I take the <STDIN> and break it down (you know decode the url encodeing) then the $form{'required-f_name'} can be assigned to a variable, but I do not know how to tell the script that I do not want to assign it to anything, but rather I want the VALUE ITSELF. The script when useing => has to have the value--yes I myself can get the value printed to screen, but how do I get the script to figure out the value and send that value not a variable representing the value?

I hope that makes since. I do not know to much about python, but I sure do appreciate all your help. Thank you

by the way all of the following is correct:

Doesn't your verification script know the key/value pairs for the data submitted by the form? For example---------> Yes

required-f_name = freddy---------->yes

right?

Isn't "required-f_name" the name in the form for the field where they enter the first name, and the value entered would be something like "freddy"?-->yes

But you are saying, if I understand you correctly, that you don't know "freddy"? ----> find out but how does the script know this so that it can send that rather then $form{'required-f_name'}<----that is what will be sent not the value becuse it comes after the =>
instruction is offline   Reply With Quote
Old 10-12-2002, 11:18 AM   Postid: 74958
sheila
Site Owner
 
sheila's Avatar

Forum Notability:
0 pts: Even-handed
[Post Feedback]
 
Join Date: Aug 1999
Location: Metro Los Angeles Area
Posts: 7,398
Hmm. I'm afraid that answering your question requires a bit more knowledge of Perl than I have. I'm sure it is possible to do what you want. Hopefully someone who knows Perl will come along soon and take a try at answering your question.

Good luck,
__________________
sheila
http://www.thinkspot.net/sheilaruns/
sheila is offline   Reply With Quote
Old 10-12-2002, 11:22 AM   Postid: 74959
instruction
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Oct 2002
Posts: 26
thank you-->hopefully someone with more perl knowledge can help--thank you though

thank you shiela for all your help
instruction is offline   Reply With Quote
Old 10-12-2002, 01:52 PM   Postid: 74962
instruction
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Oct 2002
Posts: 26
Doing it a differrent way, but would still like to know....

Would still like to know how to do what I asked at first. So if you know I would glady accept the help. I have deicided to make a jump page to temperarly allow the scriot to work. In other words I decided to create another form with hidden fields where the user has to hit continue. It will then post it to cgiemail. However I would still like to know how to post the values from one form to another form. Thanks in advance to anyone who can help.
instruction is offline   Reply With Quote
Old 10-12-2002, 02:12 PM   Postid: 74963
skolnick
Site Owner
 
skolnick's Avatar

Forum Notability:
117 pts: Helpful Contributor
[Post Feedback]
 
Join Date: Jul 2001
Location: where the boat is: Chesapeake Bay
Posts: 702
Code:
required-f_name => $form{'required-f_name'}
I'm surprised this doesn't work. I'm loaded up this weekend, but when I clear my backlog I'll take a look, unless another Perl afficionado wanders by first.
__________________
dave

S/V Auspicious
lying Annapolis MD

On the eighth day there were regular expressions.
--me

pay it forward
skolnick is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 visitors)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 04:47 AM.


Running on vBulletin®
Copyright © 2000 - 2013, Jelsoft Enterprises Ltd.
Hosted & Administrated by FutureQuest, Inc.
Images & content copyright © 1998-2013 FutureQuest, Inc.
FutureQuest, Inc.