<% ' save as get_upload_form_variables.asp %>

<title>Get Variables for writing upload form</title>
<link rel="stylesheet" type="text/css" href="../index.css">
<b><font face="Webdings" color="#FF0000">3</font></b><i><font size="1"><a href="http://www.classicaspreference.com/aspexamples/menu.htm">Back
to ASP Examples
<b><font face="Webdings" color="#FF0000">3</font><font size="1"><i><a target="_blank" href="select_database.asp">Back
to Database Selection</a></i></font></b><br>
<b><font face="Webdings" color="#FF0000">3</font></b><i><font size="1"><a href="default.asp">Back to Database Interface Wizard Home Page</a></font><br>
<b><font face="Webdings" color="#FF0000">4</font><i><font size="1"><a title="Please let me know if this has been helpful." href="mailto:lilpeck@gmail.com?subject=database interface generation wizard">This
script cobbled together by Lil Peck</a></font></i></b><br>
<form method="POST" action="create_upload_form.asp">
dim strDB
strDB = request.form("dbname")

Response.Write"<U>Category Table: <b>"&Request.Form("CatTable") & "</U></b>"
dim CatFields
CatFields = Request.Form("CatTable")
Response.Write"<input type=""hidden"" name=CatTable value="& server.urlencode(Request.Form("CatTable")) &"> <br>"

Dim objADOXDatabase
Set objADOXDatabase = Server.CreateObject("ADOX.Catalog")

objADOXDatabase.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(strDB) & ";"

response.write "<table><tr><TD>"
For Each objTable in objADOXDatabase.Tables
If objTable.Type = "TABLE" then
if objTable.Name = request.form("CatTable") then

Response.Write "<font><br><b>Check a box for your Category Table's Foreign Key Field:</font></b> (Usually the primary key.)"

For Each objColumn in objTable.Columns
Response.Write "<tr><td><font size=1>" & "Key Field? <input type=""checkbox"" name=""CatForeignKey"" value="& objColumn.Name &"> " & " Name Field? <input type=""checkbox"" name=""CatName"" value="& objColumn.Name &">" & objColumn.Name & "</td></tr> "


End If
end if
response.write "</TD</tr></table>"
Set objADOXDatabase = Nothing

Sub FormDataDump(bolShowOutput, bolEndPageExecution)
Dim sItem

'What linebreak character do we need to use?
Dim strLineBreak
If bolShowOutput then
'We are showing the output, so set the line break character
'to the HTML line breaking character
strLineBreak = "<br>"
'We are nesting the data dump in an HTML comment block, so
'use the carraige return instead of <br>
'Also start the HTML comment block
strLineBreak = vbCrLf
Response.Write("" & strLineBreak)
End If

'Display the Request.Form collection
For Each sItem In Request.Form
'Response.Write" sItem:"&(sItem)
If sItem = "CatTable" then

response.write ""
If sItem = "Table" then

Response.Write"<br><font size=2><b><U>FILE TABLE: </U></b>" &"<input type=""text"" name=Table value="& server.urlencode(Request.Form(sItem)) &"></font><br>"
If sItem = "dbname" then
Response.Write"<br><font size=2><b><U>DATABASE: </U>" &"<input type=""text"" name=dbname value="& server.htmlencode(Request.Form(sItem)) &"></font></b><br>"
If sItem = "key" then
Response.Write"<br><font size=2><U><b>Primary Key: </U></font></b> "
response.write "<input type=""text"" name=key value="& server.htmlencode(Request.Form(sItem)) &"></font><br><BR>"

response.write "<font size=1>"
Response.Write "&nbsp;&nbsp;File Category?<input type=""checkbox"" name=Filecategory value="& server.htmlencode(Request.Form(sItem)) &"> "
Response.Write "Filename?<input type=""checkbox"" name=Filename value="& server.htmlencode(Request.Form(sItem)) &"> "
Response.Write "&nbsp;&nbsp;File Title?<input type=""checkbox"" name=Filetitle value="& server.htmlencode(Request.Form(sItem)) &"> "
Response.Write "&nbsp;&nbsp;File Description?<input type=""checkbox"" name=Filedescription value="& server.htmlencode(Request.Form(sItem)) &"> "
Response.Write "&nbsp;&nbsp;File Size?<input type=""checkbox"" name=Filesize value="& server.htmlencode(Request.Form(sItem)) &"> "
Response.Write "&nbsp;&nbsp;File Type?<input type=""checkbox"" name=Filetype value="& server.htmlencode(Request.Form(sItem)) &"> "
Response.Write "&nbsp;&nbsp;Image Width?<input type=""checkbox"" name=Filewidth value="& server.htmlencode(Request.Form(sItem)) &"> "
Response.Write "&nbsp;&nbsp;Image Height?<input type=""checkbox"" name=Fileheight value="& server.htmlencode(Request.Form(sItem)) &"> "
Response.Write "&nbsp;&nbsp;File Date?<input type=""checkbox"" name=Filedate value="& server.htmlencode(Request.Form(sItem)) &"> "
Response.Write "&nbsp;&nbsp;User ID?<input type=""checkbox"" name=Fileuser value="& server.htmlencode(Request.Form(sItem)) &"> "

Response.Write("<b>" & server.htmlencode(Request.Form(sItem)) & "</b><br></font>" & strLineBreak)

end if
end if
end if
end if


'Display the Request.QueryString collection
Response.Write(strLineBreak & strLineBreak)
For Each sItem In Request.QueryString
'Response.Write(" - [" & Request.QueryString(sItem) & "]" & strLineBreak)

'If we are wanting to hide the output, display the closing
'HTML comment tag
'If Not bolShowOutput then Response.Write(strLineBreak & "-->")

'End page execution if needed
If bolEndPageExecution then Response.End
End Sub
<b><font size="4">Designate which fields are for which values.</font></b>
field names are to the far right. Check a box that corresponds to the correct
value for each field. Check only ONE box for each field. This form assumes that
your image gallery will have a separate table for image gallery categories.</b><br>
<font size="1"></p>

call FormDataDump(TrueOrFalse, TrueOrFalse) %></font>
<input type="submit" value="Submit"><input type="reset" value="Reset"></p>