Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing values with Querystring in ASP

Status
Not open for further replies.

FrankieNASCAR

Programmer
Apr 22, 2005
5
US
Hi All,

I am having a problem with sending a querystring in an ASP page. Here's my code:

<form enctype="multipart/form-data" Action="GetUpload.asp?hdept=savpath" method="Post" id="form1" name="form1">

My problem is that the querystring value 'savpath' is actually a JavaScript variable field and not a literal. I need the value within the 'savpath' field to be passed to the next ASP page. How can I accomplish this? Everytime I try something the receiving page shows me 'savpath' as the querystring value, not the contents of 'savpath'.

Thanks.

 
If you need it to reflect the value of "savpath", then you need to use the value, not the hard-coded literal "savpath", which is what you have done above. One way to deal with this would be leave the action of your form blank and have a javascript function within the onsubmit that would create the action statement.

Looking back at the above, let me see if I can demonstrate with some pseudo-code. (I may be a little rusty, but it should give you the idea):
Code:
<script language="javascript">
[COLOR=green]--javascript function here[/color]
function setFormAction
  form1.action = "GetUpload?hdept=" + myJavascriptVariable;
  form1.submit();
</script>

[COLOR=green]HTML down here...[/color]
<form enctype="multipart/form-data" method="Post" id="form1" name="form1" [COLOR=red]onsubmit="setFormAction()"[/color]>


------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Thanks for your reply Chopstik. I have your code in place. I still can't get it to work correctly because when I include the '+ myJavascriptVariable;' I get an syntax error. When I remove that part of the code I get to the next ASP page but of course I do not have the value of the variable. I'm still seaching for an answer
 
myJavascriptVariable refers to whatever you are calling that variable. You need to change that to the "savpath" name (presuming that is the name of your variable). My original code was intended as an example, not as a literal.

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top