Hey all so I just wrote one of my first ASP scripts, but I found a problem with it, I just am not very sure how to fix it. The textarea below the "Brand" textarea to be specific. Lets say I type something in it then hit enter and type another thing when I submit the results only show the first item I enter and not the second.... am i being clear?
Here's the code...
Thanks,
John
Here's the code...
PHP:
<%
ink_type = request("ink_type") : if ink_type = "" then ink_type = "Toner"
brand = request("brand") & " "
product_list = request("product_list")
'response.write product_list
'response.end
if product_list <> "" then
toner_keywords = request("toner_keywords")
ink_keywords = request("ink_keywords")
fax_keywords = request("fax_keywords")
drum_keywords = request("drum_keywords")
toners_keywords = request("toners_keywords")
inks_keywords = request("inks_keywords")
faxes_keywords = request("faxes_keywords")
drums_keywords = request("drums_keywords")
select case ink_type
case "Toner": arrKeywords = split(request("toner_keywords"), vbcrlf)
case "Ink": arrKeywords = split(request("ink_keywords"), vbcrlf)
case "Fax": arrKeywords = split(request("fax_keywords"), vbcrlf)
case "Drum": arrKeywords = split(request("drum_keywords"), vbcrlf)
case "Toners": arrKeywords = split(request("toners_keywords"), vbcrlf)
case "Inks": arrKeywords = split(request("inks_keywords"), vbcrlf)
case "Faxes": arrKeywords = split(request("faxes_keywords"), vbcrlf)
case "Drums": arrKeywords = split(request("drums_keywords"), vbcrlf)
end select
if instr(1,product_list,vbcrlf) = 0 then product_list = product_list & vbcrlf
if instr(1,product_list,vbcrlf) then 'multiple
arrProduct_List = split(product_list, vbcrlf)
for m = 0 to ubound(arrProduct_List)-1
for i = 0 to ubound(arrKeywords)
if trim(brand) <> "" then
str1 = str1 & brand & arrProduct_List(m) & " " & arrKeywords(i) & vbcrlf
else
end if
if trim(arrProduct_List(m)) <> "" then str2 = str2 & arrProduct_List(m) & " " & arrKeywords(i) & vbcrlf
next
next
else ' single
'for i = 0 to ubound(arrProduct_List)
' if trim(arrProduct_List(i)) <> "" then str2 = str2 & arrProduct_List(i) & " " & arrKeywords(i) & "<br>"
'next
end if
else
'strConnection = "driver={MySQL};server=localhost;uid=toner;pwd=toner;database=monster_toner_db;option="
'Set Conn = Server.CreateObject("ADODB.Connection")
'Set RS = Server.CreateObject("ADODB.Recordset")
'Conn.Open strConnection
toner_keywords = "toner"",""toner cartridge"",""printer cartridge"",""laser toner"",""cartridge"",""printer toner"
ink_keywords = "cartridge"",""ink"",""ink cartridge"",""inkjet"",""inkjet cartridge"",""printer cartridge"",""printer ink"
fax_keywords = "fax film"",""fax ribbon"",""fax ribbon cartridge"",""ribbon"",""film"
drum_keywords = "drum printer"",""drum cartridge"",""drum unit"
toners_keywords = "toners"",""toner cartridges"",""printer cartridges"",""laser toners"",""cartridges"",""printer toners"
inks_keywords = "cartridges"",""inks"",""ink cartridges"",""inkjets"",""inkjet cartridges"",""printer cartridges"",""printer inks "
faxes_keywords = "fax films"",""fax ribbons"",""fax ribbon cartridges"",""ribbons"",""films"
drums_keywords = "drum printers"",""drum cartridges"",""drum units"
end if
response.write "<textarea cols=100% rows=20>" & str2 & str1 & "</textarea>"
%>
<basefont face="arial" size=1>
<form action="" method=post>
<table cellspacing=10 cellpadding=10><tr><td valign=top>
<br>
<input type=radio value="Toner" <%if ink_type = "Toner" then response.write "checked" %> name="ink_type"><b>1. Toner</b>
<input type=radio value="Ink" <%if ink_type = "Ink" then response.write "checked" %> name="ink_type"><b>2. Ink</b>
<input type=radio value="Fax" <%if ink_type = "Fax" then response.write "checked" %> name="ink_type"><b>3. Fax</b>
<input type=radio value="Drum" <%if ink_type = "Drum" then response.write "checked" %> name="ink_type"><b>4. Drum</b>
<br>
<input type=radio value="Toners" <%if ink_type = "Toners" then response.write "checked" %> name="ink_type"><b>5. Toners</b>
<input type=radio value="Inks" <%if ink_type = "Inks" then response.write "checked" %> name="ink_type"><b>6. Inks</b>
<input type=radio value="Faxes" <%if ink_type = "Faxes" then response.write "checked" %> name="ink_type"><b>7. Faxes</b>
<input type=radio value="Drums" <%if ink_type = "Drums" then response.write "checked" %> name="ink_type"><b>8. Drums</b>
<br><br>
Brand: <input type=text value="<%=trim(brand)%>" name="brand" size=20 >
<br>
<textarea name="product_list" cols=50 rows=10><%=product_list%></textarea><br>
<input type=submit value=submit>
</td><td valign=top>
<br> <br>
<b>1. Toner keywords:</b><br> <textarea name="toner_keywords" cols=50 rows=7><%=replace(toner_keywords,""",""", vbcrlf)%></textarea><br><br>
<b>2. Ink keywords: </b><br><textarea name="ink_keywords" cols=50 rows=7><%=replace(ink_keywords,""",""", vbcrlf)%></textarea><br><br>
<b>3. Fax keywords: </b><br><textarea name="fax_keywords" cols=50 rows=7><%=replace(fax_keywords,""",""", vbcrlf)%></textarea><br><br>
<b>4. Drum keywords: </b><br><textarea name="drum_keywords" cols=50 rows=7><%=replace(drum_keywords,""",""", vbcrlf)%></textarea><br><br>
<b>5. Toners keywords:</b><br> <textarea name="toners_keywords" cols=50 rows=7><%=replace(toners_keywords,""",""", vbcrlf)%></textarea><br><br>
<b>6. Inks keywords: </b><br><textarea name="inks_keywords" cols=50 rows=7><%=replace(inks_keywords,""",""", vbcrlf)%></textarea><br><br>
<b>7. Faxes keywords: </b><br><textarea name="faxes_keywords" cols=50 rows=7><%=replace(faxes_keywords,""",""", vbcrlf)%></textarea><br><br>
<b>8. Drums keywords: </b><br><textarea name="drums_keywords" cols=50 rows=7><%=replace(drums_keywords,""",""", vbcrlf)%></textarea><br><br>
</td></tr>
</table>
</form>
<body>
</body>
</html>
Thanks,
John