Solved

Posting to more than one file...

Posted on 2002-03-05
11
179 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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 discusses moving either the default database or any database to a new volume.

743 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

9 Experts available now in Live!

Get 1:1 Help Now