Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple syntax question

Status
Not open for further replies.

shopwise

Technical User
Sep 22, 2008
52
0
0
US
I am receiving Expected ')' error when using the below syntax. As I do not know asp too well, I'm not sure how to fix it:

<%if Not Isnull("products.productfam")then response.Write("<a href="productfamily_processor.asp?productfamily=(products.Fields.Item("productfam").Value)" target="_self">other variations available</a>") End If %>



 
you're missing a closing bracket
you're not using double quotes correctly

here's some cleaner code

Code:
<%
	strProductFam = products.Fields.Item("productfam").Value
	if not isNull(strProductFam) then
		response.write "<a href='productfamily_processor.asp?productfamily=" & strProductFam & "' target='_self'>other variations available</a>
	end if
%>

or another variation, even easier to read (IMO)

[code]
<%	
	strProductFam = products.Fields.Item("productfam").Value
	if not isNull(strProductFam) then
%>
	<a href="productfamily_processor.asp?productfamily=<%=strProductFam%>" target="_self">other variations available</a>
<% 
	end if 
%>
[/code]

--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top