I'm using dreamweaver and asp and am new to using dreamweaver (macromedia studio 8) and i'm having an issue with a very simple process. I have a page that loops through a flat (csv) file database. It counts and displays the files first record headers, using the split function. I have the loop outputting a drop down box in front of each record field (header) after displaying the breakdown of the lists first record the user is supposed to use the drop down box next to each field so that they can put in order (using the drop down menu numbers) all of the mailing fields that I display on the side with numbers next to them. Essentially they are telling the app which split of the first record is the first name, last name..etc. I then want to check the value of each drop down box so that I can use that info to pull the first name, last name..etc.. from the file and create a query string to input only those sections of the first record into a mailing database. Since there will be no standard for the file format to be in I have to have the user tell the app where their first name, last name..etc.. fields are and then loop through the file and retrieve only those pieces so I can build a string and upload them to a database.
Now that I explained all that... The issue i'm having most is that I don't know how loop through and check before... or , when redirected to the new page, to pull the info from the post page so that I can check the values of the drop down menu to see if it is left blank or has 1, for first name, 2 for last name...etc..etc.. and then use that to go from there and then use the split function again to pull only those splits/values from the records in the file.
My basic question to start with I guess is how can I best retrieve the drop down menu values. Do I loop through with some script some how, if so...how ...help! or do i just click submit and then in the new page retrieve the values for each drop down menu box, which is what i'm trying to do so far but I don't know how to get and pass values from the drop down menus and pass from one page to another without using session variables. Would like to just on page load check the values of each box so that I can use that to choose which values to pull when I do the split of the csv file. Here's some code for what I have so far, it's pretty basic to this point..
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/conn.asp
" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
>
<head>
<table width="100%" align="center">
<tr>
<td width="35%"><img src="images/logo_seaway250
.gif" /></td>
<td align="left"><h1>Match your fields here!</h1></td>
</table>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>File Location Page</title>
<script language="javascript">
function Submit_OnClick()
{
alert("so far so good :p");
document.all.submit();
}
</script>
</head>
<body bgcolor="#FFFFCC">
<p>Please match the proper mailing field number with the record info by putting the number in the box next to the record column.<br />If the record column doesn't belong to one of the mailing column names then leave it blank.<br />Not All numbers will always be used nor do they have to be if record info doesn't exist for that field.</p>
<p><font color="#0033FF">Here is a list of each individual column of your first record....</font></p>
<table width="100%" align="center">
<tr>
<td width="20%" valign="top">1.) First Name<br /><br />2.) Last Name<br /><br />3.) Company<br /><br />
4.) Address Line 1<br /><br />5.) Address Line 2<br /><br />6.) City<br /><br />7.) State<br /><br />8.) Zip</td>
<td>
<%
iCount = 0
iColCnt = 0
iRecCnt = 0
Set fs=Server.CreateObject("Sc
ripting.Fi
leSystemOb
ject")
Set f=fs.OpenTextFile(Server.M
apPath("Sa
mple Database 051507.CSV"), 1)
Do While Not f.AtEndOfStream
sTemp = f.Readline
if iCount = 0 then
aTemp = Split(sTemp,",")
iColCnt = ubound(aTemp)+1
iTempCnt = 0
iNmCnt = 0
'Output each section/column of the split (determined by each coma)
'and break the line so each column displays on a new row.
Do While iTempCnt < iColCnt
iNmCnt = iNmCnt + 1
Response.Write("<SELECT NAME='ddlNum' & iNmCnt><OPTION VALUE='1'><OPTION VALUE='2'>1<OPTION VALUE='3'>2<OPTION VALUE='4'>3<OPTION VALUE='5'>4<OPTION VALUE='6'>5<OPTION VALUE='7'>6<OPTION VALUE='8'>7<OPTION VALUE='9'>8</SELECT>- ")
aTemp(iTempCnt) = aTemp(iTempCnt) & "<br>"
Response.Write(aTemp(iTemp
Cnt))
iTempCnt = iTempCnt + 1
Loop
else
iRecCnt = iRecCnt + 1
End If
iCount = iCount + 1
Loop
f.Close
Set f=Nothing
Set fs=Nothing
%>
</td>
<td valign="top">We're lining up the mailing fields with the data from your file...<br /> so we can import them to the mailing databases matching columns.<p>This picture gives you a graphical representation of what<br /> we are basicly doing...</p><p><img src="images/matching.jpg"/
></p>
</td>
</tr>
<tr>
<td width="100%" colspan="3" align="center"><p><form action="Display.asp" method="post">
<input type="submit" value="Submit" onclick="javascript:Submit
_OnClick()
" /></form></p>
</td>
</tr>
</table>
<%
Session("ColCnt") = iColCnt
Response.Write("<h6><font color='Red'> Num of Columns = </font><font color='Blue'>" & iColCnt & "</font><br>")
Response.Write("<font color='Red'>Record Count = </font><font color='Blue'>" & iRecCnt & "</font></h6>")
%>
</body>
</html>
That's the first page that reads the file, which I just have hard coded and in the site itself at the moment but will be read on client side later.. hopefully. On the second page I don't have anything really because I can't seem to figure out how to retrieve the values from the drop down menus on the first page "Matching.asp" so that I can deal with them on what I now have called the "Display.asp" page because I was trying to, for now, output the values just to see if I was passing and retrieving them right. I know in C# .NET all I had to really do was Request.Params.Get("blah")
and it would retrieve the values from the post to the new page.
ps. I have the loop creating the drop down menu and have a count var to append a 1, 2..etc..etc to the name of the control so that the name is unique. "numlist1", "numlist2"..etc. You can see this in the code above.
Believe me.. I know this is a mess... sorry folks :/ and thx in advance.
Start Free Trial