?
Solved

Posting to more than one file...

Posted on 2002-03-05
11
Medium Priority
?
219 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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 600 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
Six Sigma Control Plans

777 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