Jump to content

Matar

Members
  • Posts

    102
  • Joined

  • Last visited

Posts posted by Matar

  1. hi all can i use if not isstring like if not IsNumeric???i need a function thats can acsept just string values and check if there are any spiecial chr loke (@,#.. etc)i konw its a stupied qaustion!! :)

  2. hi i mean when i add the dropdown menu inside the table area its will be out of the scoop of the table ,, like this gender : name :...etc i want it like thatname .... etcgender i will try put it after the table tag :)

  3. hi i think this error cause the database is not opened form append "write" i think there are anthor way to add data to db its easier from dns-less connection this is the code

    <%Dim conn            Dim rs  Set Conn = Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/webdata/tst.mdb"))** db bath set rs = Server.CreateObject("ADODB.recordset")      RS.open "samer",Conn,2,2 ** table name // 2,2 mean open this db for append rs.AddNewrs.Fields("record name") = Request.Form("input type name in the form") examplers.Fields("email") = Request.Form("usermail")rs.Updaters.CloseSet rs = NothingSet Conn = NothingResponse.Redirect "confirm.asp" ** by this u can tell the user that the reg action complete%>
  4. hi all thank u all for ur help ,, realy i am very happy cause ur Attention and ur ideaswill i want u to see this script ,, i make the regsteratin action and check action and the addtion to the db in the same page ,, see this code ..

    <%Function ValidateField(sFieldValue, sFieldType) Dim bFieldIsOkay bFieldIsOkay = True Select Case LCase(sFieldType)  Case "name"  If trim(Len(sFieldValue)) = 0 Then bFieldIsOkay = False  Case "mail"  If Len(sFieldValue) < 5 Then    bFieldIsOkay = False  Else    If Instr(1, sFieldValue, " ") <> 0 Then    bFieldIsOkay = False    Else    If InStr(1, sFieldValue, "@") < 2 Then      bFieldIsOkay = False    Else      If InStrRev(sFieldValue, ".") < InStr(1, sFieldValue, "@") + 2 Then      bFieldIsOkay = False      End If    End If    End If  End If  case "s"   If (sFieldValue) = "a" Then bFieldIsOkay = False  Case "address"  If Len(sFieldValue) = 0 Then bFieldIsOkay = False  case "la"    If Len(sFieldValue) = 0 Then bFieldIsOkay = False  Case "city"  If Len(sFieldValue) = 0 Then bFieldIsOkay = False  Case "state"  If Len(sFieldValue) <> 2 Then bFieldIsOkay = False  Case "zip"  If Len(sFieldValue) <> 5 And Len(sFieldValue) <> 10 Then      bFieldIsOkay = False    End If    Case Else 'if an unknown type gets in reject form!  bFieldIsOkay = False End Select ValidateField = bFieldIsOkayEnd FunctionSub ShowFormField(strField) %> <TR>  <TD ALIGN="right"><B><%= strField %>:</B> </TD>  <TD><INPUT NAME="<%= strField %>" TYPE="text" VALUE="<%= Request.Form(strField) %>"></INPUT></TD>  <TD><%  If dictFields(LCase(strField)) Then  Response.Write "<IMG SRC=""IMAGES22.JPG"" BORDER=""0"" WIDTH=""25"" HEIGHT=""25"">"  End If  %></TD> </TR> <%End Sub%><%Dim Field      'looping variableDim dictFields 'dictionary for failed fieldsSet dictFields = Server.CreateObject("Scripting.Dictionary")  For Each Field in Request.Form If ValidateField(Request.Form(Field), Field) = False Then  dictFields.Add LCase(Field), True End IfNext 'FieldIf Request.Form.Count <> 0 And dictFields.Count = 0 Then Dim conn            Dim rs  Set Conn = Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/webdata/tst.mdb"))set rs = Server.CreateObject("ADODB.recordset")      RS.open "samer",Conn,2,2rs.AddNewrs.Fields("Name") = Request.Form("name")rs.Fields("email") = Request.Form("email")rs.Fields("address") = Request.Form("address")rs.Fields("city") = Request.Form("city")rs.Fields("state") = Request.Form("state")rs.Fields("zip") = Request.Form("zip")rs.Updaters.CloseSet rs = NothingSet Conn = NothingResponse.Redirect "thx.asp"%>  <% For Each Field In Request.Form  Response.Write Field & ": " & Request.Form(Field) & "<BR>" & vbCrLf Next 'FieldElse If Request.Form.Count <> 0 Then  %>  plese check your data  <% End If %> <FORM ACTION="<%= Request.ServerVariables("Script_Name") %>" METHOD="post" NAME="TheForm"> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0"> <%  ShowFormField("name") ShowFormField("mail") ShowFormField("address") ShowFormField("city") ShowFormField("state") ShowFormField("zip") %>  </TABLE> <INPUT TYPE="reset" VALUE="Reset The Form"></INPUT> <INPUT TYPE="submit" VALUE="Submit The Form"></INPUT><BR> <BR> </FORM> <%End If%>
    will but again i face one small proplem how i can add a dropdown menu to this
    <FORM ACTION="<%= Request.ServerVariables("Script_Name") %>" METHOD="post" NAME="TheForm"> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0"> <%  ShowFormField("name") ShowFormField("mail") ShowFormField("address") ShowFormField("city") ShowFormField("state") ShowFormField("zip") %>  </TABLE> <INPUT TYPE="reset" VALUE="Reset The Form"></INPUT> <INPUT TYPE="submit" VALUE="Submit The Form"></INPUT><BR> <BR> </FORM> <%
    when i add a dropdown menu its will be out of scoop of the table its will be the first item befor name fieldhow can add it ???thanks all :)
  5. hi man the u give me is work very very good but there are moe problem when the page show the error the other field is cleared why ?for example if the user enter the name correctly and the avg correctly but the schools name invalid ..when he press submit he will see the error msg but the all filed will clear what i should doing ?regards

  6. hi man in fact i face too many problem with this script and ,, but i solve this proplem before 1 hour this article before i solve the problem thnak u man i think we will be a friends

  7. hi man i write this code in reg.asp

    <html><form method="post"  name=form action = "add.asp">  <b>enter you name </b><br>  <input type="text" name="name" value="<%=Request("name")%>"><br>  <input type="submit" value="submit"  name=submit></form><% If Len(Request("name"))= 0 then %><%response.write("enter correct data")%>  <%=Server.UrlEncode(Request("name"))%><% End IF %>
    and this code in add.asp
    <%dim namedim avg_secname = request.form("name")if name = "" thenresponse.redirect("d.asp?error=" & server.URLEncode("enter a name"))end if%>
    its work good if u have and extra information in this code ur welcome
  8. hi i face a big problem and i dont have more time its my graduation project willthe problem is i wrote a validate form code there are 2 page reg.asp its include the form and the action on add.asp add.asp include the form validation code and the adding data code to the db the problem is ,, when the user enter a invalid data he will show a massege tell him enter a correct data but in this time the valid data will transfred to the db .i need a small help with this idea if the user enter a invalid data he will show massege in the same page (reg.asp)and if he enter a correct data he will show a page contain his data and a cofirm button when he press on this button he will add the data to the database and redirect him to thx.asp page . plz help me

  9. hi man thank u very much for this useful idea if u tell me how

    Then you need the reg.asp to look for an error variable in the querystring and display the message.
    cause my mind cant understand this step but the prev step work very good plz help me ,, this is a graduation project i dont have more time thx for ur help
  10. hii dont know if you know the asp concepts but i will give a brief intro and the how get data form access data base and displayit in web page the intro here :you must red this page : http://www.w3schools.com/asp/asp_intro.aspthis is the code you need :

    do until rs.EOF for each x in rs.Fields Response.Write(x.value ) Response.Write(x.name & "<br />") next rs.MoveNext[/b]loop '' the bold text for print the contant of name recoredrs.closeconn.close%>youcan control the data you need by sql statments
  11. hi man i use the server variable to validate the form values cause when i make the action to anthor page if the user enter a correct a data he will still in the add.asp page so the user will not confirmed that the regestreation action is completed . this is a simple code*******reg.asp<form name = "form" method "post" action = "add.asp"><input type = "text" name = "user"><input type = "pass" name = "pass"></form>*******add.aspdim userdim pass user = request.form("user")pass = requset.form("pass")if user = "" thenresponse.write("enter the user name")end ifif pass = "" thenresponse.write("enter the password")end ifhere the code of the adding data to the database*********when i use this code if the user enter a correct data he will still in add.aspif you can solve this code i will use this method . thank you :)

  12. hi i need a code thats post these values to anthor page , the problem i face is the action on the server varible not to anthor page for example not to chk.asp i need a code can post these server varible to anthor page when the user enter a correct data he will show what he enter then i need a submit button thats post the data to anthor page . thx all

  13. hi all i write the following code to validate a form

    <%Function ValidateField(sFieldValue, sFieldType) Dim bFieldIsOkay bFieldIsOkay = True Select Case LCase(sFieldType)  Case "name"  If trim(Len(sFieldValue)) = 0 Then bFieldIsOkay = False  Case "email"  If Len(sFieldValue) < 5 Then    bFieldIsOkay = False  Else    If Instr(1, sFieldValue, " ") <> 0 Then    bFieldIsOkay = False    Else    If InStr(1, sFieldValue, "@") < 2 Then      bFieldIsOkay = False    Else      If InStrRev(sFieldValue, ".") < InStr(1, sFieldValue, "@") + 2 Then      bFieldIsOkay = False      End If    End If    End If  End If    Case "address"  If Len(sFieldValue) = 0 Then bFieldIsOkay = False  Case "city"  If Len(sFieldValue) = 0 Then bFieldIsOkay = False  Case "state"  If Len(sFieldValue) <> 2 Then bFieldIsOkay = False  Case "zip"  If Len(sFieldValue) <> 5 And Len(sFieldValue) <> 10 Then    bFieldIsOkay = False  End If      Case Else   bFieldIsOkay = False End Select ValidateField = bFieldIsOkayEnd FunctionSub ShowFormField(strField) %> <TR>  <TD ALIGN="right"><B><%= strField %>:</B> </TD>  <TD><INPUT NAME="<%= strField %>" TYPE="text" VALUE="<%= Request.Form(strField) %>"></INPUT></TD>  <TD><%  If dictFields(LCase(strField)) Then  Response.Write "<IMG SRC=""C:\Inetpub\wwwroot\a.jpg"" BORDER=""0"" WIDTH=""25"" HEIGHT=""25"">"  End If  %></TD> </TR> <%End Sub%><%Dim Field      'looping variableDim dictFields 'dictionary for failed fieldsSet dictFields = Server.CreateObject("Scripting.Dictionary")  For Each Field in Request.Form If ValidateField(Request.Form(Field), Field) = False Then  dictFields.Add LCase(Field), True End IfNext 'FieldIf Request.Form.Count <> 0 And dictFields.Count = 0 Then??????????????????????????? %><BR> <BR> <B>Here's what you entered:</B><BR> <% For Each Field In Request.Form  Response.Write Field & ": " & Request.Form(Field) & "<BR>" & vbCrLf Next 'FieldElse If Request.Form.Count <> 0 Then  %>  make sure thats your data is correct .  <% End If %> <FORM ACTION="<%= Request.ServerVariables("Script_Name") %>" METHOD="post" NAME="TheForm"> <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0"> <% ShowFormField("Name") ShowFormField("Email") ShowFormField("Address") ShowFormField("City") ShowFormField("State") ShowFormField("Zip") %> </TABLE> <INPUT TYPE="reset" VALUE="Reset The Form"></INPUT> <INPUT TYPE="submit" VALUE="Submit The Form"></INPUT><BR> <BR> </FORM> <%End If%>
    where the chr "?" showen i need a code thats when the user enter a vaild data post his data to a data base the problem is ,, i cant get the form value or i cant make the action of the form on anthor page ,, how i cam post this data to anthor page .
  14. hi man if there are more than field how the code will be i try your code and it is work prop but when i try for more than field there are too many error a dublicateedthank you

  15. hi i am trying to validate html form with asp function , so the problem is how i will know which field is empty ,, this is the i wrote ***dim name name = request.form("name")if name = "" thenresponse.redirect = ("error.asp?name_null")end if ********after the user enter the data its will store in database , so i make an add.asp page thats will requset the data from the form like this :<%dim name name = request.form("name")if name = "" thenresponse.write(" Enter Your Name")end if %><%Dim conn Dim rs Set Conn = Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/webdata/atc.mdb"))set rs = Server.CreateObject("ADODB.recordset") RS.open "reg",Conn,2,2rs.AddNewrs.Fields("Name") = Request.Form("name")rs.Updaters.CloseSet rs = NothingSet Conn = Nothing%>********with this code the user will Know Where is the Error , but if he Enter a correct dataand press submit he will Redirected to add.asp page and he will still um this page so , he will not redircted to the confirmation page . when i make the code like this <%dim name name = request.form("name")if name = "" thenresponse.write(" Enter Your Name")end if %><%Dim conn Dim rs Set Conn = Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/webdata/atc.mdb"))set rs = Server.CreateObject("ADODB.recordset") RS.open "reg",Conn,2,2rs.AddNewrs.Fields("Name") = Request.Form("name")rs.Updaters.CloseSet rs = NothingSet Conn = Nothingresponse.redirct="confirm.asp"%>if the user let the field empty he will redirected To the confirm page and he will think the regesteration is completed . i need a code redircted the user to error page and didcted the empty field .

  16. hi khalidi think u work with local network in the company and global website , so you can istall the iis on your pc in the local network , and one in this network can access your site by for example : http://your pc ip address/index.aspu must take on mind when u work in localhost with localnetwork any one on the network can access the site by this way. finally the network usres can see the local site , thats same the global site on the net matar

  17. this is the code <%response.cachecontrol = "no-cache"response.expires = -1%><%user=Request.form("user")pass=Request.form("pass")if user = "" then // this is line 18 Response.Redirect("error.asp?error=name_null")elseif pass = "" thenResponse.Redirect ("error.asp?error=pass_null")end if end if Dim conn Dim rs Set Conn = Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open(Server.Mappath("/webdata/log.mdb"))set rs = Server.CreateObject("ADODB.recordset") sql= "SELECT * FROM stu WHERE user = '" & Request.Form("user") & "' and pass = '" &Request.form("pass")&"'" set RS = Conn.Execute(SQL)if rs.eof then response.Redirect ("error.asp?error=Name_Entry")elseif rs("pass") <> pass then response.Redirect ("error.asp?error=pass_Entry") end ifend if%> <table border="1" width="100%"><tr><%for each x in rs.Fields%> <% if x.value <>"" then%> <%response.write("<th>" & x.name & "</th>")%> <%end if%><%next%></tr> <%do until rs.EOF%> <tr> <%for each x in rs.Fields%> <% if x.value <>"" then%> <td> <%Response.Write(x.value)&"<br/>"%></td> <%end if%> <%next rs.MoveNext%> </td> <% loopRS.CloseSet RS = nothingConn.CloseSet Conn = nothingsession.abandon%></table><div style="position: absolute; width: 100px; height: 100px; z-index: 2; right: 439px; top: 378px" id="layer2"> </div></body></html>

  18. hi i make a student login , so when i do it in the localhost it was very good with no error , but when i test it in my hosting i see this error Response object error 'ASP 0156 : 80004005' Header Error /log.asp, line 18 The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page contenplaese help me

  19. i try this code in my log page but when i go back , i see the cannot found pagethe code i mean this Response.CacheControl = "no-cache"Response.Expires = -1how i can load the anthor page that describe you can't go back in fact you give a very very very useful information thank u my friend :)

×
×
  • Create New...