control value must be case sensitive?

M

Matthew Louden

I am using VBScript for ASP. The control value must be case sensitive? The
following example should print the "fname" value, but if if I change
"submit" back to "SUBMIT". Then it works fine.

<%
If (Request.QueryString("submit") = "submit") Then
Response.Write(Request.QueryString("fname"))
End if
%>

<form action="formtest.asp" method="get">
<P><input type="text" name="fname">
<P><input type="submit" name="submit" value="SUBMIT">
</form>

Please advise! Thanks!
 
A

Aaron Bertrand - MVP

Yes, equality of strings is case sensitive. You can use lcase or ucase on
both sides of the equation to make sure it is not case sensitive...
 
J

John Beschler

IN VB Script control names are not case sensitive;
however, in string comparisons VB script IS case
sensitive. The problem is not with your control name. It
is with the fact that the string comparison is comparing
the contents of Request.QueryString("submit") which
is "SUBMIT" with a string which has a value of "submit".
They are not the same.

String comparisons in VB are always case sensitive.

HTH,
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top