SUBMIT button problem on .asp page

I'm wondering if anyone can see anything wrong with the .asp page below. It uses a form to collect 4 fields of info then Submit it. It works perfectly well on my development server (all the files and includes files are the same) but fails on the production server - it appears not to be going into the first IF statement. I've spent the day on this and can't see why.... this is an old page that has worked for a long time. Something must have changed on the server that would break it, but as yet I don't see anything that is deprecated that would stop if from functioning. It seems to me the value of request.form("doit") is coming back as 'Submit' rather than 'doit'.

Thanks for suggestions...
Ron



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 

<%@LANGUAGE="VBSCRIPT"%>
<!--#INCLUDE VIRTUAL="includes/clsLayout.asp"-->
<!--#INCLUDE VIRTUAL="connect.asp"-->
<%


dim objLayout
set objLayout = new clsLayout
objLayout.Version = 2

if request.form("doit") <> "" AND request.Form("x1") <> "" AND request.Form("x2") <> "" AND request.Form("x3") <> "" AND request.Form("x4") <> "" then  'make sure all fields are filled
	
	login = request.Form("x2")
	pwd   = request.Form("x1")

	

	
	
	username = request.Form("x3")
	companyname = request.Form("x4")
		
	Set	rs = Server.CreateObject("ADODB.Recordset")
	rs.ActiveConnection = objConnection
	strSQL = "SELECT * FROM FILE_ACCESS WHERE login_name='" & login & "' and password='" & pwd & "'"
	rs.Source = strSQL
	rs.Open
	if not rs.eof then
		Session("isLogged_in") = TRUE
		Session("login") = login 
		Session("login_name")  = rs("login_name")
		Session("canDownload") = rs("canDownload")
		Session("canUpload")   = rs("canUpload")
		Session("uploadDir")   = rs("uploadDir")
		Session("DownloadSet") = rs("DownloadSet")
		
		strSQL = "INSERT INTO [ClientDownloadAccess] (loginUsed, passwordUsed, UserName, CompanyName, SSVersionOnPage) VALUES "
		strSQL = strSQL & " ('"& login &"', '"& pwd &"',  '"& username &"', '"& companyname &"', 'V5.1.10'); "

		
		
		
'DEBUG
'response.write(strSQL)

		
		
		
		rs.Close
	    rs.Source = strSQL
		rs.Open
		



Set	rs=nothing

		
	response.Redirect( "secure.asp?" )
	end if
	rs.Close
end if

Session("isLogged_in") = FALSE
%>
<html>
<head>
<% = objLayout.head("Secure Files") %>

<script type="text/javascript" language="javascript">
<!--
function setfocus() {
document.getElementById("inputtext").focus();
}
// -->

</script>
</head>

<body bgcolor="#5A82AD" link="orange" vlink="#999999" onload="document.forms.choices.x3.focus();">
<form name="choices" action="index.asp" method="post" autocomplete="Off">
<center>




<table class="page" border="0" width="800"  cellspacing="0" cellpadding="0" bgcolor="29517B">
<tr bgcolor="#FFFFFF">
	<td width="100" height="20" align="right" valign="middle"> 
	<img src="../images/kccflog_textlogo_249w.gif" />
	</td>
	<td width="700" height="20" align="right" valign="middle">
		<font face="Verdana, Arial, Helvetica, sans-serif" size="3">Customer Upload / Download Area&nbsp;&nbsp;</font>
	</td>
</tr>
<tr>
	<td width="780" colspan="2" align="center"> 				
		<font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">
						
			<br/><br/><br/>
			<u>Please</U> enter the following information then click the 'Submit' button:<br/><br/></font>
			<font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="orange">
			
			
		</font><br/>&nbsp;
		

	              <table align="center" valign="middle">
		
				  						<tr> 
                      <td width="169" align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#CCCCCC">Your Personal Name</font></b></td>
                      <td width="70" align="left"><input type="text" name="x3" size="30" maxlength="30" /></td>
					</tr>
										<tr> 
                      <td width="169" align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#CCCCCC" size="2">Your Company Name</font></b></td>
                      <td width="70" align="left"><input type="text" name="x4" size="30" maxlength="50" /></td>
					</tr>
				  
				  
				  
				  
                    <tr> 
                      <td width="169" align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#CCCCCC" size="2">Login</font></b></td>
                      <td width="70" align="left" ><input type="text" name="x2" size="12" maxlength="12" id="inputtext" /></td>
                    </tr>
					<tr> 
                      <td width="169" align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#CCCCCC" size="2">Password</font></b></td>
                      <td width="70" align="left"><input type="password" name="x1" size="12" maxlength="12" /></td>
					</tr>
					


									
					
					
					<tr>
					  <td>&nbsp;</td>
					</tr>
					<tr>
                      <td ></td>

<td align="right"><input type="submit" name="doit" value=" Submit "/><br/><br/></td>

                     </tr>
                  </table> 
	</td>
</tr>
</table>
</center>
</form>
</body>
</html>

Open in new window

KnowledgeWareAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
What error if any are you getting?

Try running this and let me know what prints out.  Also, is there a reason you are not scrubbing your input fields for username and password?

Should your include virtual start with a slash?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@LANGUAGE="VBSCRIPT"%>
<!--#INCLUDE VIRTUAL="includes/clsLayout.asp"-->
<!--#INCLUDE VIRTUAL="connect.asp"-->
<%

response.write "step 1<br>" ' *********  Debug **************

dim objLayout
set objLayout = new clsLayout
objLayout.Version = 2


response.write "step 2<br>" ' *********  Debug **************


if request.form("doit") <> "" AND request.Form("x1") <> "" AND request.Form("x2") <> "" AND request.Form("x3") <> "" AND request.Form("x4") <> "" then  'make sure all fields are filled
	
response.write "step 3<br>" ' *********  Debug **************	
	
	login = request.Form("x2")
	pwd   = request.Form("x1")

	

	
	
	username = request.Form("x3")
	companyname = request.Form("x4")
		
	Set	rs = Server.CreateObject("ADODB.Recordset")
	rs.ActiveConnection = objConnection
	strSQL = "SELECT * FROM FILE_ACCESS WHERE login_name='" & login & "' and password='" & pwd & "'"
	rs.Source = strSQL
	rs.Open
	if not rs.eof then
		Session("isLogged_in") = TRUE
		Session("login") = login 
		Session("login_name")  = rs("login_name")
		Session("canDownload") = rs("canDownload")
		Session("canUpload")   = rs("canUpload")
		Session("uploadDir")   = rs("uploadDir")
		Session("DownloadSet") = rs("DownloadSet")
		
		strSQL = "INSERT INTO [ClientDownloadAccess] (loginUsed, passwordUsed, UserName, CompanyName, SSVersionOnPage) VALUES "
		strSQL = strSQL & " ('"& login &"', '"& pwd &"',  '"& username &"', '"& companyname &"', 'V5.1.10'); "

		
		
		
'DEBUG
response.write(strSQL) &"<br>"

		
		
		
		rs.Close
	    rs.Source = strSQL
		rs.Open
		



Set	rs=nothing

response.write "step 4<br>" ' *********  Debug **************
		
	response.Redirect( "secure.asp?" )
	end if
response.write "step 5<br>" ' *********  Debug **************	
	rs.Close
end if
response.write "step 6<br>" ' *********  Debug **************
Session("isLogged_in") = FALSE
%>
<html>
<head>
<% = objLayout.head("Secure Files") %>
<script type="text/javascript" language="javascript">
<!--
function setfocus() {
document.getElementById("inputtext").focus();
}
// -->

</script>
</head>

<body bgcolor="#5A82AD" link="orange" vlink="#999999" onload="document.forms.choices.x3.focus();">
<form name="choices" action="index.asp" method="post" autocomplete="Off">
  <center>
    <table class="page" border="0" width="800"  cellspacing="0" cellpadding="0" bgcolor="29517B">
      <tr bgcolor="#FFFFFF">
        <td width="100" height="20" align="right" valign="middle"><img src="../images/kccflog_textlogo_249w.gif" /></td>
        <td width="700" height="20" align="right" valign="middle"><font face="Verdana, Arial, Helvetica, sans-serif" size="3">Customer Upload / Download Area&nbsp;&nbsp;</font></td>
      </tr>
      <tr>
        <td width="780" colspan="2" align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF"> <br/>
          <br/>
          <br/>
          <u>Please</U> enter the following information then click the 'Submit' button:<br/>
          <br/>
          </font> <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="orange"> </font><br/>
          &nbsp;
          <table align="center" valign="middle">
            <tr>
              <td width="169" align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#CCCCCC">Your Personal Name</font></b></td>
              <td width="70" align="left"><input type="text" name="x3" size="30" maxlength="30" /></td>
            </tr>
            <tr>
              <td width="169" align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#CCCCCC" size="2">Your Company Name</font></b></td>
              <td width="70" align="left"><input type="text" name="x4" size="30" maxlength="50" /></td>
            </tr>
            <tr>
              <td width="169" align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#CCCCCC" size="2">Login</font></b></td>
              <td width="70" align="left" ><input type="text" name="x2" size="12" maxlength="12" id="inputtext" /></td>
            </tr>
            <tr>
              <td width="169" align="right"><b><font face="Verdana, Arial, Helvetica, sans-serif" color="#CCCCCC" size="2">Password</font></b></td>
              <td width="70" align="left"><input type="password" name="x1" size="12" maxlength="12" /></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td ></td>
              <td align="right"><input type="submit" name="doit" value=" Submit "/>
                <br/>
                <br/></td>
            </tr>
          </table></td>
      </tr>
    </table>
  </center>
</form>
</body>
</html>

Open in new window

0
Dave BaldwinFixer of ProblemsCommented:
It seems to me the value of request.form("doit") is coming back as 'Submit' rather than 'doit'.
That's what it should be.  The value is sent along with the name.  if you write...

xstr = request.form("doit")

Then xstr should equal " Submit ".
0
KnowledgeWareAuthor Commented:
Thanks padas for putting that into the code comment window, and David for comment re returns.

There is no error message, but instead of executing line 69 and redirecting to another page - nothing happens. It stays on the same page. The main 'IF' statement does not appear to be entered. When I paste response.write statements inside the IF they are not written to the page. As I mentioned the page executes properly on my development server but not on the production site, I suspected perhaps some poor syntax was killing it on the production site.

Re the / on the virtual includes - no it doesn't need that.

ron
0
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

KnowledgeWareAuthor Commented:
And - will try this tomorrow, can't do it from where I am tonight!
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
In the code I gave you, what was sent to the screen?

"The main 'IF' statement does not appear to be entered. " and "there is no error message, but instead of executing line 69 and redirecting to another page - nothing happens."

Does this mean if you view source, you can see above the html tag you can see "step 1<br>step 2<br>step 6<br>" ?

If so, the next thing I would try at the top of the page is

<%
response.write request.form
dim x

if request.form("doit") <> "" then
    response.write "doit-yes"
     else
      response.write "doit-no"
end if

if request.Form("x1") <> "" then
response.write "x1-yes "
     else
      response.write "x1-no "
end if


if request.Form("x2") <> "" then
response.write "x2-yes "
     else
      response.write "x2-no "
end if


if  request.Form("x3") <> "" then
response.write "x3-yes "
     else
      response.write "x3-no "
end if


if request.Form("x4") <>"" then
response.write "x4-yes "
     else
      response.write "x4-no "
end if


%>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KnowledgeWareAuthor Commented:
Hello padas - thanks. The page needs to work today so we found a workaround, the form in index.asp now redirects to index2.asp which is a duplicate page. This works, for some reason. I will try your code a bit more tonight/tomorrow.
0
KnowledgeWareAuthor Commented:
Thanks padas - this was not the solution but this debug code worked well. I've temporarily solved this by jumping to a second index2.asp page when the submit button is clicked, the page would not reload itself successfully on one server for unknown reasons and I've exhausted my time on this. I'm awarding points to padas although this was not  a solution - experts correct me if this is wrong but it seems fair.

Thanks to all
Ron
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.