CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Passing javascript variables to Perl...

 



thedust
New User

Aug 28, 2002, 11:48 PM

Post #1 of 4 (555 views)
Passing javascript variables to Perl... Can't Post

I am trying to create a script for sending a link to an article to a friend via email. This is how it goes:

First the user click "SEND TO A FRIEND" and it brings up a new window. I send along the referring URL as a variable for this new pop-up window.

The user fills out a form and then submits to the Perl script. The Perl script needs to take that javascript variable somehow and parse it into a regular scalar variable to print out in the body of the email.



Anybody ever try this? Sorry if this is an easy fix- I'm new and I'm on a TIGHT DEADLINE, so if anyone can help, please do... thanks in advance!



Dusty


thebitch
User

Aug 29, 2002, 12:03 AM

Post #2 of 4 (552 views)
Re: [thedust] Passing javascript variables to Perl... [In reply to] Can't Post

You can't do that. Javascript is on the client's machine,
and your perl is on the server.
The only way they can communicate is throught CGI,
so you need to make that's what you do.

Code
 
<form name="TheOnlyWayToCOmmunicateToAServer">
<input type=hidden name="SetThisWithJavaScript">
<input type=hidden name="ThenSubmitTheForm">
<input type=hidden name="Otherwise">
<input type=hidden name="Manipulate">
<input type=hidden name="the">
<input type=hidden name="URL">
<input type=hidden name="aka">
<input type=hidden name="Location">
</form>



thedust
New User

Aug 29, 2002, 7:43 AM

Post #3 of 4 (548 views)
Re: [thebitch] Passing javascript variables to Perl... [In reply to] Can't Post

so it SHOULD work with something like say...



<input type="hidden" name="url" value="window.location" />



?????


thebitch
User

Aug 30, 2002, 2:37 AM

Post #4 of 4 (536 views)
Re: [thedust] Passing javascript variables to Perl... [In reply to] Can't Post

*snicker *

No. Now where'd you get that idea?

I don't do javascript ( at least on perlguru.com), but
i thought you did.

http://www.hotscripts.com/JavaScript/Tips_and_Tutorials/Forms/

You have a form on a webpage.
To communicate with with a CGI script,
you need to submit that form to it.
You can manipulate form elements with javascript.
So you need to use javascript to set form values,
so that when you submit the form,
the perl CGi script gets them.

On the perl side, you need CGI.pm to parse
the submitted form correctly.

Got it?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives