470,815 Members | 1,293 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Sending Variable content, not Variable name

Here's what I'm trying to do:

I have a large number of pages that call a pop-up survey page. It is
important to know what page the survey is referring to - so I am
passing the name of the referring page through the URL.

The problem I'm having is that when the data on the survey page is
submitted through formmail, I can't seem to get the referring page's
name sent too - I keep getting the variable name itself, not the
contents of the variable.

So for instance, if the referring page is 123.htm, and I assign it to
variable "external_url", I get the name "external_url" sent through
formmail, not the contents of the variable.

HELP.

Here's the script I'm using to on the popup survey page (or at least
the part to parse out the referring page's name).

<Script LANGUAGE="javascript">
external_url = window.location.search.substring(1);
</script>

Amongst my input fields for formmail I presume I would include:

<input type="hidden" name="subject" value="external_url">

But this doesn't work.

I haven't bothered to include the rest of the form code - but it is
working fine (ie I get the mail results back, its just that "subject"
comes back as "external_url" instead of the referring page's name.

Also, I know that "external_url" is working because I have a
document.write(external_url); in the document to ensure that the
variable is working and containing the correct info displayed on the
screen.

I figure this is a simple issue - but I can't figure it out. Thanks
in advance.

Jul 23 '05 #1
2 1338
"Ian Hubling" <ia*@hubling.com> wrote:
<Script LANGUAGE="javascript">
external_url = window.location.search.substring(1);
</script>
Amongst my input fields for formmail I presume I would include:
<input type="hidden" name="subject" value="external_url">


You can't just include variable names and expect javascript to interpret
them. Instead, you should have javascript write out the hidden input itself,
like this:

document.write('<input type="hidden" name="subject" value="' + external_url
+ '">');

Your document will then contain a hdiden input with the correct value.

--
Matt Kruse
Javascript Toolbox: http://www.mattkruse.com/javascript/
Jul 23 '05 #2


Thanks a million Matt - I had to play around with it - but I understood
what you were saying and managed to get it to work.

This will save a lot of work and coding in the long run. Again - thanks
for the help.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Paul Lamonby | last post: by
4 posts views Thread by splicemix | last post: by
6 posts views Thread by Anuradha | last post: by
7 posts views Thread by bleachie | last post: by
2 posts views Thread by lstanikmas | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.