robsampson
01-10-2009, 08:02 AM
Am facing a problem, with this script...
I want two fields to be written by star , in order to hide . and this script does it , but ,
wat actually is my page opens directly with star letter , rather i need to open my page with the phoneno and email aftr clicking the button i want to make a change to the star to the respective fields ..........
How can i do this...plz suggest??
1. vbscript
2. function getPhone(text)
3. dim textsize
4. textsize = Len(text)
5. text = Left(text,5)
6. For index = 0 to textsize
7. text = text & "*"
8. Next
9. getphone = text
10. End Function
11.
12. Function getEmail(text)
13. dim textsize
14. textsize =Len(text)
15. dim atpos
16. atpos = instr(text,"@") - 5
17. text = Left(text,5)
18. For index = 0 to textsize
19. if atpos = index+1 then
20. text = text & "@"
21. else
22. text = text & "*"
23. end if
24. Next
25. getemail = text
26. End Function
27.
28. Set oConn = Server.CreateObject("ADODB.Connection")
29. Set oRs = Server.CreateObject("ADODB.Recordset")
30. oConn.Open "Provider=SQLOLEDB; Data Source = ria; Initial Catalog = northwind; Integrated Security = sspi;"
31.
32. sSql = "SELECT phone,email,id FROM tbl1 userid =4 "
33. oRs.Open sSql, oConn
34. While not oRs.EOF
35. Response.write("<table><tr><form method='post'><td >phone : </td><td>"&getPhone(ors(0))&"</td><td width='10%'align='right'mail :</td><td>"&getEmail(ors(1))&"</td><input name='submit' type='submit' value='check'><input type='hidden' name='nameid' value='" & ors(2) & "' ></form></tr></table>")
36. oRs.MoveNext()
37. Wend
38. ors.close
39. oconn.close
40.
41. if request.form("submit")="check" then
42.
43. i=1
44. end if
45. if request.form("nameid") <> "" then
46. set star1 = oConn.Execute("select resid from tbl1 where id= '" &request.form("nameid")&"'")
47. if not star1.eof then
48. sl = "UPDATE tbl1 SET star = '" & i & "' where resid= '" &request.form("nameid")&"' and userID = " & userid
49. oConn.Execute sl
50. End if
51. End if
52.
53. %>
I want two fields to be written by star , in order to hide . and this script does it , but ,
wat actually is my page opens directly with star letter , rather i need to open my page with the phoneno and email aftr clicking the button i want to make a change to the star to the respective fields ..........
How can i do this...plz suggest??
1. vbscript
2. function getPhone(text)
3. dim textsize
4. textsize = Len(text)
5. text = Left(text,5)
6. For index = 0 to textsize
7. text = text & "*"
8. Next
9. getphone = text
10. End Function
11.
12. Function getEmail(text)
13. dim textsize
14. textsize =Len(text)
15. dim atpos
16. atpos = instr(text,"@") - 5
17. text = Left(text,5)
18. For index = 0 to textsize
19. if atpos = index+1 then
20. text = text & "@"
21. else
22. text = text & "*"
23. end if
24. Next
25. getemail = text
26. End Function
27.
28. Set oConn = Server.CreateObject("ADODB.Connection")
29. Set oRs = Server.CreateObject("ADODB.Recordset")
30. oConn.Open "Provider=SQLOLEDB; Data Source = ria; Initial Catalog = northwind; Integrated Security = sspi;"
31.
32. sSql = "SELECT phone,email,id FROM tbl1 userid =4 "
33. oRs.Open sSql, oConn
34. While not oRs.EOF
35. Response.write("<table><tr><form method='post'><td >phone : </td><td>"&getPhone(ors(0))&"</td><td width='10%'align='right'mail :</td><td>"&getEmail(ors(1))&"</td><input name='submit' type='submit' value='check'><input type='hidden' name='nameid' value='" & ors(2) & "' ></form></tr></table>")
36. oRs.MoveNext()
37. Wend
38. ors.close
39. oconn.close
40.
41. if request.form("submit")="check" then
42.
43. i=1
44. end if
45. if request.form("nameid") <> "" then
46. set star1 = oConn.Execute("select resid from tbl1 where id= '" &request.form("nameid")&"'")
47. if not star1.eof then
48. sl = "UPDATE tbl1 SET star = '" & i & "' where resid= '" &request.form("nameid")&"' and userID = " & userid
49. oConn.Execute sl
50. End if
51. End if
52.
53. %>