Jump to content

Can someone please tell me whats wrong with this code?


billybob joe

Recommended Posts

<HTML><BODY bgcolor="lightblue"><form action="index.asp" method="get">Your name: <input type="text" name="Name" size="20" />Your name: <input type="text" name="Authentication Code" size="20" /><input type="submit" value="Submit" /></form><%dim fnameName=Request.QueryString("Name")Name=Request.QueryString("Authentication Code")If Name="Gunnar" Then && Authentication Code="Its me, Gunnar, So let me in!" Then     Response.Write("Hi, Gunnar, Your so awesome :-)")      End If%></body></html>

I made this just to test it for something im making... <.< >.> <.<

Link to comment
Share on other sites

add this as the first line

<%@ language=vbscript %>

correct your syntax of your IF statementfrom

If Name="Gunnar" Then && Authentication Code="Its me, Gunnar, So let me in!" Then

to:

If Name="Gunnar" & AuthenticationCode="Its me, Gunnar, So let me in!" Then

the page will now load without error. Any other errors I did not check for

Link to comment
Share on other sites

Urrg... still not working... whats wrong with this?<%@ language=vbscript %><HTML><BODY bgcolor="lightblue"><form action="index.asp?" method="get">Your name: <input type="text" name="Name" size="20" />Authentication Code: <input type="password" AuthenticationCode="Authentication Code" size="20" /><input type="submit" value="Submit" /></form><%dim namedim AuthenticationCodeName=Request.QueryString("Name")Name=Request.QueryString("Authentication Code")If Name="Gunnar" & Password="123" Then Response.Write("Hi, Gunnar, Your so awesome :-)") End If%></body></html>

Link to comment
Share on other sites

I'm pretty sure vbscript has to be surrounded by quotation marks like any string value. AuthenticationCode is not an HTML attribute, so I replaced it with name which is and which is used for user submitting information. Dim is a keyword for creating variables. I believe & is suppose to be And. If this doesn't work (I'm not an ASP programmer, and only relying on what I've learned with Visual Basic 6, which uses some of the same syntax), you can always look at the source code of the examples at w3schools.com

<%@ language="vbscript" %><HTML><BODY bgcolor="lightblue"><form action="index.asp" method="get">Your name: <input type="text" name="Name" size="20" />Authentication Code: <input type="password" name="AuthenticationCode" size="20" /><input type="submit" value="Submit" /></form><%dim Namedim AuthenticationCodeName=Request.QueryString("Name")Name=Request.QueryString("AuthenticationCode")If Name="Gunnar" And AuthenticationCode="123" ThenResponse.Write("Hi, Gunnar, Your so awesome :-)")End If%></body></html>

Link to comment
Share on other sites

I have corrected your original code so that it works, only minor changes were needed. (I removed the form action, you can put that back)

<%@ language=vbscript %><HTML><BODY bgcolor="lightblue">	<form  method="get">		Your name: <input type="text" name="Name" size="20" />		Your name: <input type="text" name="Authentication Code" size="20" />		<input type="submit" value="Submit" />	</form><%		Name1 = Request.QueryString("Name")	Name2 = Request.QueryString("Authentication Code")	If Name1="Gunnar" and Name2="Its me, Gunnar, So let me in!" Then		Response.Write("Hi, Gunnar, Your so awesome :-)")	End If%></body></html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...