Jump to content

Form Variables Driving Me Crazy


Sirena609
 Share

Recommended Posts

Ok, here goes. I have an online store and I am trying to incorporate a shipping companies rate tool into it and I am not having much luck. Here is a link to the test page (its not actually "live" within the store yet):http://www.qualityfloorsdirect.com/collect...ollectionid=777Here is a link to the coding for the page:http://www.qualityfloorsdirect.com/collect...ate_newCODE.aspIts long and I figured if I put up a link it would make it easier.This is how the B2B tool works: I pass the required data to the freight company via a link to their B2B Rate Tool with a url like so:"http://www.rlcarriers.com/b2brateparam.asp?id=9373821281&origin= 45177&dest=34482&class1=55&weight1=1200&custdata=123456 &respickup=X&resdel=X&insidechrg=X&furnchrg=X&cod=65"and they send me back another url with the necessary information in it using more url parameters.THE SNAG: I made a form field "zipcode" so that customers can enter their zip code into it and then I figured if I did dest= <% Request.Form ("zipcode") %> in the url it would work, but alas, it isn't and it is driving me nuts!!Now when I first made the site I know i had to individualize those calculated cartons input fields so I just added the product id after so the name="VARstockQuantity<%=(products.Fields.Item("product_id").Value)%>" I tried doing that with the zip code fields so it wasdest= <% Request.Form ("zipcode<%=(products.Fields.Item("product_id").Value)%>") %> but I got syntax errors and couldn't get that to go either. Any and all help would be GREATLY appreciated, this is really starting to drive me absolutely crazy!!Thanks,Sirena

Link to comment
Share on other sites

Keep in mind that variables in Request.Form are only available when someone submits a form. If they haven't submitted the form with the zip code in it, then Request.Form("zipcode") isn't going to have anything in it.

I tried doing that with the zip code fields so it wasdest= <% Request.Form ("zipcode<%=(products.Fields.Item("product_id").Value)%>") %> but I got syntax errors and couldn't get that to go either.
It would be:Request.Form("zipcode" & products.Fields.Item("product_id").Value)
Link to comment
Share on other sites

I cam up with a workable solution so I figured I would share it just in case this thread ever applies to anyone else. What I am going to use is create one main form and have it go to a form_processor.asp The main form on the products page will submit the form variables via url parameters to the form_processor.asp which will then take the necessary values to write them to a url and then I will use a response.redirect to have it send it to the B2B rate tool. So thank god, problem solved!

Link to comment
Share on other sites

Ok new problem and this is something I always get stuck on. Here is the code:<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><!--#include file="Connections/QFD.asp" --><%Dim Recordset1__MMColParamRecordset1__MMColParam = "1"If (Request.QueryString("productid") <> "") Then Recordset1__MMColParam = Request.QueryString("productid")End If%><%Dim Recordset1Dim Recordset1_numRowsSet Recordset1 = Server.CreateObject("ADODB.Recordset")Recordset1.ActiveConnection = MM_QFD_STRINGRecordset1.Source = "SELECT product_id, manufacturerid, originzip, manufacturer FROM productentry, Manufacturers WHERE Manufacturers.manufacturerid = productentry.manufacturer AND product_id = " + Replace(Recordset1__MMColParam, "'", "''") + ""Recordset1.CursorType = 0Recordset1.CursorLocation = 2Recordset1.LockType = 1Recordset1.Open()Recordset1_numRows = 0%><%DIM TW, ZC, CTTW = Request.Querystring("TW" & Recordset1.Fields.Item("product_id").Value)ZC = Request.Querystring("zipcode" & Recordset1.Fields.Item("product_id").Value)CT = Request.Querystring("VARstockquantity" & Recordset1.Fields.Item("product_id").Value)Response.redirect ("http://www.rlcarriers.com/b2brateparam.asp?id=5089472225&origin=(Recordset1.Fields.Item("&originzip&").Value)&dest=("&ZC&")&class1=55&weight1=("&TW&")&custdata=CT|(Recordset1.Fields.Item("&product_id&").Value)&respickup=&resdel=X&insidechrg=&furnchrg=&cod=0")%><%Recordset1.Close()Set Recordset1 = Nothing%>PROBLEM: formating the response.redirect properly, I am horrible at this aspect of VB coding. Help please!

Link to comment
Share on other sites

Response.redirect ("http://www.rlcarriers.com/b2brateparam.asp?id=5089472225&origin=" & Recordset1.Fields.Item("originzip").Value & "&dest=" & ZC & "&class1=55&weight1=" & TW & "&custdata=CT|" & Recordset1.Fields.Item("product_id").Value & "&respickup=&resdel=X&insidechrg=&furnchrg=&cod=0")The & operator will join two strings or variables together.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...