Link to home
Start Free TrialLog in
Avatar of punjabijatt
punjabijatt

asked on

add new record.

sorry i realized that i did not have the file included. I was so sure i included that file that i blindly copy pasted the code.   lol


just one more thing if you can help me. Basically this is a project me and my friend are working on and one of the pages is suppose to add new record to the database. i don't know it will not update it. I put values in the form and then it just clears the field but it does not add the record to the database.



<%Option Explicit%>
<!--#include virtual="/adovbs.inc"-->
<html>
<head>
<title>
</title>
</head>
<body bgcolor="#000066">

<H1 align=center><font color="blue">Registration</font></h1>

<form action="register.asp" method="post" >
<h2><font color="blue">Name:</font> <input type="text" name="nam" size=20>
<h2><font color="blue">Phone: </font><input type="text" name="pho" size=10>
<h2><font color="blue">Pin:</font> <input type="text" name="pinn" size=3><sub><font color="red">(*Optional)</font></sub>
<h2><font color="blue">Choose Plan:</font> <select name="plan">
<option selected> Student          $20.00 on the card
<option>Normal           $50.00 on the card
<option>Business          $100.00 on the card
</option>
</select>
<input type="submit" name="submit" value=" Submit ">
</form>

 





<%

 If request.form("submit")="Submit" then

Dim rs, sql, conn



      set conn= createobject("ADODB.Connection")


      conn.open "int213db"


      sql="Select * From abcTel where 1<> 1"

         
      Set rs = server.createobject("Adodb.recordset")
      
      
      rs.open "abcTel",  conn, adopenstatic, adlockoptimistic

      rs.addnew
      rs("client_name") = request.form("nam")
      rs("client_phone_number") = request.form("pho")
      rs("card_pin") = request.form("pinn")
      rs("card_plan_name") = request.form("plan")
      rs.update
      
 









rs.close
set rs=nothing
conn.close
set conn=nothing


end if
%>        
</body>
</html>


ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial