469,636 Members | 1,970 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,636 developers. It's quick & easy.

Session varaiables

For the following code when ever i open the this page the text box has /
i ahve set the value of text box with session variables whic is exuted only when submit button is clicked....Pls Help me....

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>REGISTRATION</title>
  6. <script language="javascript" src="validate.js" type="text/javascript"></script>
  7. </head>
  8. <body>
  9. <h4><b>WELCOME TO REGISTRATION PAGE</b></h4>
  10. <form id="registration" name="registration" method="post"  onsubmit="return ValidateForm();">
  11.  <table width="346">
  12.  
  13.  <tr><br />
  14.   <td width="338" align="Center"><h2 align="center">REGISTRATION</h2></td>
  15.  </tr> 
  16.   <tr>
  17.      <td width="338" align="center" nowrap="nowrap"><h4 align="left">User Name:
  18.           <input name="txtuname" type="text" value=<%=session("username")%> /> <h4 align="left">First Name:
  19.                     <input name="txtfname" type="text" value=<%=session("fname")%> />
  20.      </h4></td>
  21.  </tr>
  22.  
  23.   <tr>
  24.      <td width="338" align="center"><h4 align="left">Last Name:   
  25.           <input name="txtlname" type="text" value=<%=session("lname")%> />     
  26.      </h4></td>
  27.  </tr>
  28.  
  29.  <tr>
  30.      <td align="center" ><h4 align="left">Password:     
  31.           <input name="txtpassword" type="password" value=<%=session("password")%> />     
  32.      </h4></td>
  33.  </tr>
  34.  
  35.   <tr>
  36.      <td align="center"><h4 align="left">EMAIL ID:    
  37.           <input name="txtemail"  type="text" value=<%=session("mail")%> />     
  38.      </h4></td>
  39.  </tr>
  40.  
  41.   <tr>
  42.      <td align="center"><h4 align="left">Phone No:    
  43.           <input name="txtphno" type="text" value=<%=session("phno")%> />     
  44.      </h4></td>
  45.  </tr>
  46.  
  47.    <tr>
  48.      <td align="center"><h4 align="left">Mobile No:    
  49.           <input name="txtmno" type="text" value=<%=session("mno")%> />     
  50.      </h4></td>
  51.  </tr>
  52.  
  53.   <tr>
  54.      <td align="center"><h4 align="left">Address:                       
  55.        <textarea name="txtadd1" wrap="physical" value=<%=session("add1")%>></textarea>
  56.      </h4></td>
  57.  </tr>
  58.  <% response.Write(session("mail"))%>
  59.  <tr>
  60.      <td align="center"><h4 align="left">Address2:    
  61.           <textarea name="txtadd2" value=<%=session("add2")%>></textarea>     
  62.      </h4></td>
  63.  </tr>
  64.  
  65.  <tr>
  66.      <td align="center"><h4 align="left">City:    
  67.           <input name="txtcity" type="text" value=<%=session("city")%>/>     
  68.      </h4></td>
  69.  </tr><tr>
  70.      <td align="center"><h4 align="left">State:    
  71.           <input name="txtstate" type="text" value=<%=session("state")%> />     
  72.      </h4></td>
  73.  </tr>
  74.  
  75.  <tr>
  76.      <td align="center"><h4 align="left">Country:    
  77.           <input name="txtcountry" type="text" value=<%=session("country")%> />     
  78.      </h4></td>
  79.  </tr>
  80.  
  81.  <tr>
  82.      <td align="center"><h4 align="left">Zip code:    
  83.           <input name="txtzip" type="text" value="<%=session("zip")%>" />     
  84.      </h4></td>
  85.  </tr>
  86.  
  87.  <tr><br />
  88.      <td align="center"><input name="btnsubmit" type="submit" id="btnsubmit" value="Submit" />
  89.       <input type="reset" />     </td>
  90.  </tr>     
  91. </table>
  92. </form>
  93.  
  94.  
  95.  
  96. </body>
  97. </html>
  98. <%
  99.  
  100. if(request.form("btnsubmit")<>"") then
  101. mail=request.form("txtemail")
  102. id=request.form("txtuname")
  103.  
  104. set conn=server.CreateObject("ADODB.connection")
  105. conn.Mode = 3
  106. ConnString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=Rajesh;Port=3306;DATABASE=agstc2008;UID=root;PWD=sa;character set=utf8;"
  107. conn.open ConnString
  108. set rs=server.CreateObject("ADODB.recordset")
  109. query="select * from tbluser"
  110. Set rs = conn.execute(query)
  111. no=2      
  112.  
  113. while not RS.EOF
  114.  
  115. if rs("userEmailId")=mail OR rs("userId")=id THEN
  116.     Response.Write("EMAIL ID/USER ID ALREADY EXISTS")
  117.      session("username")=request.form("txtuname")
  118.     session("password")=request.form("txtpassword")
  119.     session("fname")=request.form("txtfname")
  120.     session("lname")=request.form("txtlname")
  121.     session("email")=request.form("txtemail")
  122.     session("phno")=request.form("txtphno")
  123.     session("mno")=request.form("txtmno")
  124.     session("add1")=request.form("txtadd1")
  125.     session("add2")=request.form("txtadd2")
  126.     session("city")=request.form("txtcity")
  127.     session("state")=request.form("txtstate")
  128.     session("country")=request.form("txtcountry")
  129.     session("zip")=request.form("txtzip")
  130.     no=1
  131.     end if
  132. rs.movenext
  133. wend
  134. if(no=2) then
  135.     session("username")=request.form("txtuname")
  136.     session("password")=request.form("txtpassword")
  137.     session("fname")=request.form("txtfname")
  138.     session("lname")=request.form("txtlname")
  139.     session("email")=request.form("txtemail")
  140.     session("phno")=request.form("txtphno")
  141.     session("mno")=request.form("txtmno")
  142.     session("add1")=request.form("txtadd1")
  143.     session("add2")=request.form("txtadd2")
  144.     session("city")=request.form("txtcity")
  145.     session("state")=request.form("txtstate")
  146.     session("country")=request.form("txtcountry")
  147.     session("zip")=request.form("txtzip")
  148.     response.Redirect("lsucess.asp")
  149. end if
  150.  
  151. rs.close
  152. conn.close
  153. end if
  154. %>
Nov 6 '08 #1
7 1796
DrBunchman
979 Expert 512MB
Hi gowthamkg,

Which text box has the problem?

Dr B
Nov 6 '08 #2
Hi gowthamkg,

Which text box has the problem?

Dr B
Every text box shows "/" whene ever i load this page...and password text box it is "."
Nov 6 '08 #3
DrBunchman
979 Expert 512MB
Could you try putting some single quotes around the value property of your inputs, like this:

Expand|Select|Wrap|Line Numbers
  1. <input name="txtfname" type="text" value='<%=session("fname")%>' /> 
I wonder if perhaps the interpreter is picking up the closing / of the input tag as part of the value. Probably not the problem but worth giving it a try!

Let me know how what happens,

Dr B
Nov 6 '08 #4
ITS gone..but another problem is that..once i click the submit it should check the database whether email id is present or not if so it should display EMAIL ID/USER ID ALREADY EXISTS and it should keep the same entered data's in the form...pls help me...
Nov 6 '08 #5
DrBunchman
979 Expert 512MB
Is it displaying that text?

I think the problem here might be the condition where you say If (no=2) Then...

As far as I can see you have set the variable no to equal 2 no matter what happens.

Dr B
Nov 6 '08 #6
ya i have set the no =2 default...because if there is only mail id is present it will change to 1 or else it will be directed to a page where it is inserted..
Nov 6 '08 #7
DrBunchman
979 Expert 512MB
Okay, I see what you are doing.

So does that text never display even when there is a mail id present?

Dr B
Nov 6 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Paul | last post: by
1 post views Thread by Danny Ni | last post: by
reply views Thread by joseph conrad | last post: by
14 posts views Thread by aroraamit81 | last post: by
7 posts views Thread by aroraamit81 | last post: by
1 post views Thread by Santosh | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.