Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 6th, 2006, 06:41 AM
Authorized User
 
Join Date: Oct 2006
Location: Bhopal, M.P, India.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Assigning value from variable

I have passed value from Dropdown ListBox of a form to an ASP page using POST method. In that I have stored the value to a variable. Further I want to assign the value to one some control which I want to send the same to another ASP page using the post method.

When I tried this it is showing the variable name in the final ASP page not the value.

please help.

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old November 6th, 2006, 10:47 AM
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please show your relevant code.


Woody Z http://www.learntoprogramnow.com
Reply With Quote
  #3 (permalink)  
Old November 7th, 2006, 01:37 AM
Authorized User
 
Join Date: Oct 2006
Location: Bhopal, M.P, India.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Coding in Issue.Asp
Missing code for enabling the Category List Box
------------------------------------------------
<FORM Method="POST" Action="issuetest.asp" Name="frmIssue">
<P>Category
<INPUT id=radio1 type=radio name=cat value="CA" checked onClick="showCat()">All
<INPUT type=radio name=cat value="CS" onClick="showCat()">Specific<Br>
Select Category
<SELECT id=catlist style="WIDTH: 164px" name=catlist disabled>
<OPTION selected>Stationery</OPTION>
<OPTION>Sanitary</OPTION>
<OPTION>Perishable-I</OPTION>
<OPTION>Perishable-II</OPTION>
</SELECT></P>
<INPUT TYPE="Submit" Value="Go">
</FORM>

Some Part of Coding in Issuetest.Asp
Missing code for enabling the Item List Box
--------------------------------------------
<%
Dim objCon
Dim rsItem
Dim Catlist
Dim cat

cat = Request.Form("cat")
catlist = Request.Form("catlist")
%>
<FORM Method="POST" Action="showissue.asp" Name="frmIssue">
<INPUT TYPE="Hidden" Name="cat" Value=cat>
<INPUT TYPE="Hidden" Name="catlist" value=catlist>
<%
Set objCon=Server.CreateObject("ADODB.Connection")
objcon.open "stores"

Set rsItem=Server.CreateObject("ADODB.Recordset")
If cat="CA" Then
    rsItem.open "Select Icode,Name From Item Order By Name",objCon
Else
    rsItem.Open "Select Icode,Name From Item where Category='"& catlist &"' Order by Name",objCon
End if
%>
<SELECT style="WIDTH: 281px" name="itemlist" SIZE="1" disabled>
<%
    Do While Not rsItem.EOF
        Response.Write "<OPTION VALUE="&rsItem("Icode")&">"&rsItem("Name")&"</OPTION>"
        rsItem.MoveNext
    Loop

    rsItem.Close
    Set rsItem=nothing
%>
</SELECT></P>
</FORM>

Some Part of Coding in showissue.Asp
<%
optCat = Request.Form("cat")
strCat = Request.Form("catlist")

Response.Write optcat&"<Br>"&strcat&"<br>"
%>

The output of the above code is
cat
catlist

But I want the original value stored in cat and catlist
e.g:
CS
Stationery

Thanks in advance
Reply With Quote
  #4 (permalink)  
Old November 7th, 2006, 10:57 AM
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ah.††An easy to miss little problem.

Your code:
Code:
<INPUT TYPE="Hidden" Name="cat" Value=cat>
<INPUT TYPE="Hidden" Name="catlist" value=catlist>
Needs to look more like this
Code:
<INPUT TYPE="Hidden" Name="cat" Value=<%=cat%>>
<INPUT TYPE="Hidden" Name="catlist" value=<%=catlist%>>
I am sure you see the problem now. You need to use the value from the local variables as you build the HTML. This needs to be enclosed in script tags as you can see - otherwise your HTML just uses the literal string (such as cat and catlist) rather than the variables (and thus the values) those variables hold.

Have fun,
Woody Z http://www.learntoprogramnow.com
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASSIGNING A JAVA SCRIPT VARIABLE TO A XSL VARIABLE SOMANATHAN10 XSLT 1 February 21st, 2007 03:26 AM
Assigning variable value from a radio button cybersnac VB How-To 0 February 14th, 2007 02:57 PM
Assigning a @@ROWCOUNT to a variable ioates SQL Server DTS 2 January 9th, 2004 03:16 AM
Help with assigning a variable from a binding dfranczak ADO.NET 0 July 17th, 2003 01:50 PM



All times are GMT -4. The time now is 04:16 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.