My question is this: I am looking to insert values into my SQL database using variables. These variables are defined through asp and its related html form.
I am a beginner and here is the code I have so far.
My table:
<html>
<body>
<form action="trial3.asp" method="post">
Your first name: <input type="text" name="fname" size="20" /><br>
Your last name: <input type="text" name="lname" size="20" /><br>
Your email: <input type="text" name="email" size="20" /><br>
<input type="submit" value="Submit" />
</form>
</body>
</html>
My trial3.asp:
<%
'creating the inputs for the table, first name, last name, email
dim fname, lname, email
fname=Request.form("fname")
lname=Request.form("lname")
email=Request.form("email")
%>
MySQL code within the asp:
SQL="DECLARE @fname AS varchar(50), @lname VARCHAR(50), @email VARCHAR(100)"
SQL=SQL & "SET @fname='"+fname+"'"
SQL=SQL & "SET @lname='"+lname+"'"
SQL=SQL & "SET @email='"+email+"''"
SQL=SQL & "INSERT INTO Students (First_Name, Last_Name, Email) values (@fname, @lname, @email)"
Thanks for your help!