Solved

Posting to more than one file...

Posted on 2002-03-05
11
188 Views
Last Modified: 2012-05-04
hi..

I need to know if it is possible to send the form inputs to
two files (instead of posting them only to one file?

let's assume that i have a form with:
3 one-line text area
3 scrolling text area
1 checkbox

How can i post ALL form inputs to file1.cgi   and
post only 2 one-line text area & 1 checkbox to file2.cgi

can this be done?

thanks


mary
0
Comment
Question by:mary_M
  • 4
  • 2
  • 2
  • +2
11 Comments
 
LVL 10

Expert Comment

by:oleber
ID: 6841313
javascript
0
 
LVL 10

Expert Comment

by:oleber
ID: 6841540
javascript
0
 
LVL 10

Expert Comment

by:oleber
ID: 6841543
I'm not working whith javascript for some time but you can assign values to variables and submit to diferent forms.
0
 
LVL 5

Expert Comment

by:Peewee
ID: 6841626
mary_M,
this problem crops up from time to time.  The bottom line is that an action statement within a form can only have one script to execute.  

What is possible is to call a javascript routine within the action statement and get javascript to submit multiple forms, but this gets messy, although if your carefull its a valid option.

What most developers will do is store all the info in one form and call different perl scripts which different processing, but the choice is your yours.

for good javascript examples:
http://www.irt.org

let me know if you need more help....

peewee
0
 
LVL 16

Expert Comment

by:maneshr
ID: 6842095
mary_M,


"..How can i post ALL form inputs to file1.cgi   and
                     post only 2 one-line text area & 1 checkbox to file2.cgi...."

What exactly do you mean by post form inputs to 2 files?
The files you are referring to are CGI programs.

Can you pl. explain, in plain english, what each of these scripts will do when they receive the inputs?
Can you post any relevent URL that has the HTML form that you are talking about?

"..can this be done?..."

Technically, there is always a solution. So i a optimistic that you can get a satisfactory answer, provided you provide more detail around your exact requirements.

Let me know.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 19

Expert Comment

by:Kim Ryan
ID: 6842495
As peewee says, a form can only have one associated action, or script to be executed on submission. Can you use 2 forms instead? A workaround is to have all paramters passed to your submit script, called say file1.cgi. Then let file1.cgi call file2.cgi, passing all the form paramters to it AND then call file3.cgi, just passing the parameters for the 2 one-line text areas & 1 checkbox.
0
 

Author Comment

by:mary_M
ID: 6843663
Hi everybody...

someone told me that this can be done by JS (as you all
suggetsed)

"...by putting an onSubmit="..." attribute into the
<form... tag.

The onSubmit causes a JavaScript function to load and
run the file, when done, returns  true.

The JavaScript function could launch a popup that runs
a script and  closes automatically after the script has
run."

Well, but i still don't know how to do this?!

Here is the whole story (for maneshr   and others who
requested more info):

I currently have a form that takes all data (upon
pressing sunmittion) and stores all values in an SQL DB

I didn't do that form... but it is working without any
problems.....

ok the fileds are:
Name:
Email:
Brief Describtion:
URL:
Newsletter?:   (a check box, once checked the submitter
is going to get a newsletter to his email).

What i need.. is to leave everything is it working
now... i.e. all the above value will go to the DB as
usual...

BUT

I need to take the values in the name,email and store them in
another separate file like newsletter.txt

In other words...if the checkbox is left checked (default)..
ALL inputs will go to the DB... AND name/email fileds only will
also be stored into a file: newsletter.txt
(or whatever the name is).
0
 
LVL 10

Expert Comment

by:oleber
ID: 6843834
first of all, can't you do that in just 1 script.

you maybe can do that in other way. You first call your script that put your data in the "newsletter.txt" if need. Your script creates a new page whith just a form that have hidden fields and in js you submit that form to your old script.

your first script generate something like

<html>
 <head><title></title></head>
 <body>
  <form method="POST" name='xpto' action="oldScript.pl">
   <input type="hidden" name="Name" value="xxx">
   ...
  </form>
  <SCRIPT LANGUAGE="JavaScript">
   document.xpto.submit()
  </SCRIPT>
 </body>
</html>

and your old script shell work OK.
0
 
LVL 19

Expert Comment

by:Kim Ryan
ID: 6845403
Maybe you should raise this question in the javascript area.
0
 
LVL 5

Accepted Solution

by:
Peewee earned 150 total points
ID: 6846952
mary_M,

have a look at the following links this covers your question:

http://developer.irt.org/script/880.htm

http://developer.irt.org/script/1333.htm

regards
peewee
0
 

Author Comment

by:mary_M
ID: 6850796
Peewee  ..

YES.. these are *exactly* what i needed.

One question: How did you locate these two answers in that webste... the website is too big.. so what words did you use to search for?


Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Perl 101 11 72
unable to remove invisible characters with perl 2 76
ppm conversion to curl on a module install 8 80
Regular Expression for URL 10 90
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now