473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Passing a variable's value from javascript to a perl script

Hi,

I have a text-area which contains values from mysql database and 2
buttons, Edit and Update.
When I click on the Edit button, I can edit the text-area
(initially non-editable).
After this, if I click on the Update button, the values in the
text-area must be updated in the mysql database.
I am storing the values of the text-area in a variable. I am using
javascript to pass the variable.
How do I pass this variable to a Perl script and how do I recieve
that variable in that script?

Please help me!!!

Sep 4 '07 #1
1 3266
ASM
En réponse à sa********@gmail.com qui écrivit, en date du : 4/09/07
11:40, le message suivant :
(...)
I am storing the values of the text-area in a variable. I am using
javascript to pass the variable.
Why ?
The form can't send this by itself ?
How do I pass this variable to a Perl script and how do I recieve
that variable in that script?
It is a PHP question, no ?
(or an asp question ...)

<form action="myFile.asp" method="post">
<textarea name="content" ...></textarea>
<button ....>Edit</button>
<input type=submit value="Save">
</form>

And with multiple textareas

<form action="myFile.asp" method="post">
<p>Infos 1 :
<textarea name="Text_1" ...></textarea>
<button ....>Edit</button>
<input name="save" type=submit value="Save info 1">
</p>
<p>Infos 2 :
<textarea name="Text_2" ...></textarea>
<button ....>Edit</button>
<input name="save" type=submit value="Save info 2">
</p>
<p>Infos 3 :
<textarea name="Text_3" ...></textarea>
<button ....>Edit</button>
<input name="save" type=submit value="Save info 3">
</p>
<p><input name="save" type=submit value="Save all"></p
</form>

The variables 'content'
or 'T_1' 'S_1' 'T_2' 'S_2' 'T_3' 'S_3'
are sent with their values
your asp (or php) has to analyze these couples variable+value

If you absolutly want to sent both to php and to perl

<form action="myFile.php" method="post"
onsubmit="return aspJS(this);">
<script type="text/javascript">
function aspJS() {
var url=[], f = this.elements;
for(var i=0; i<f.length; i++)
if(f[i].type=='textarea' && !f[i].disabled)
url[url.length] = f[i].name+'='+f[i].value;
if(url.length<1) {
alert('no change !');
return false;
}
setTimout(function() {
location.href = 'myFile.asp?'+url.join('&');
},10);
return true;
}
</script>

*if JS is enabled* that would call your asp and post the form to php
but ... what about disabled JS ?

--
Sep 4 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: Dave Hammond | last post by:
In document "A.html" I have defined a function and within the document body have included an IFRAME element who's source is document "B.html". In document "B.html" I am trying to call the function...
6
by: ged | last post by:
Hi, i am a oo (c#) programmer, and have not used javascript for a while and i cant work out how javascript manages its references. Object References work for simple stuff, but once i have an...
3
by: stahl.karl | last post by:
I have a CGI/Perl program that returns a string output. Is it possible to get this into a Javascript variable, where the name of the variable is defined in the Javascript and not in the Perl code?...
5
by: sfeher | last post by:
Hi All, I need to call a function(loaded with appendChild) for which I have the name as a string. .... var fnName = 'fn1'; var call = fnName + '('+ param +' )'; eval(call);
2
by: pleaseexplaintome | last post by:
Hi I have the following perl/cgi script snippet. The goal of this script is to pass a javascript variable to perl where it can be re-used later. Any help is appreciated, Thanks ...
5
by: moni | last post by:
Hi.. I am trying to use javascript for google maps display. If I call the javascript function from my aspx file I use: <input type="text" id="addresstext" value="Huntington Avenue,...
6
by: roop1 | last post by:
Hello gits, I found this snippet that you offered to another person and I was wondering if it wouldn't work for me as well: <script type="text/javascript"> function...
8
by: Harch84 | last post by:
Hi I have a html page with javascript in it that assigns a set of coordinates to javascript variables. The question I have is how can I then send these variables to a Perl CGI script using a...
6
by: satish2112 | last post by:
how can i pass a variable's value from javascript to perl script? how can i receive that value in the perl script? please help me!!!
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.