473,563 Members | 2,696 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3293
ASM
En réponse à sa********@gmai l.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="retur n 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=='textare a' && !f[i].disabled)
url[url.length] = f[i].name+'='+f[i].value;
if(url.length<1 ) {
alert('no change !');
return false;
}
setTimout(funct ion() {
location.href = 'myFile.asp?'+u rl.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
45479
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 defined in "A.html", but every attempt results in an "is not a function" error. I have tried to invoke the function using...
6
5573
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 object collection and stanrd using it it starts to fall apart. Clearly there is something about javascript's usage of passing "By ref" that i am not...
3
6769
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? For example, it seems that the following should work, but it doesn't appear to. Is this valid code? CGI code --- get_string.pl ------ ...
5
5000
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
4864
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 #!/ois/usr/bin/perl -w use strict; use CGI qw(:standard); my $cgi=new CGI; my $flg=0;
5
9846
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, Boston, MA" name="yourName" style="width: 287px" />
6
3170
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 do_onload() { alert('hello'); } </script> <body onload="do_onload();">
8
5470
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 submit on a html form. An example of some of the code below: var map; var geocoder = null; var addressMarker;
6
2016
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
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7885
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7948
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.