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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

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


New User

Aug 28, 2002, 11:48 PM

Post #1 of 4 (584 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!



Aug 29, 2002, 12:03 AM

Post #2 of 4 (581 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.

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

New User

Aug 29, 2002, 7:43 AM

Post #3 of 4 (577 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" />



Aug 30, 2002, 2:37 AM

Post #4 of 4 (565 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, but
i thought you did.

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