lazzydog
asked on
sql insert statement for asp pages
Hello Experts,
I need your help with sql insert statement for my asp page.
Here's what I have and it's not working.
<%
Dim sql_insert, con
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName)values('CRLast Name','CRF irstName') "
con.Execute (sql_insert)
%>
Thanks.
I need your help with sql insert statement for my asp page.
Here's what I have and it's not working.
<%
Dim sql_insert, con
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName)values('CRLast
con.Execute (sql_insert)
%>
Thanks.
I would try this
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName) values("'" & CRLastName & "'," & "'" & CRFirstName & "')"
con.Execute (sql_insert)
Below is a sample of one of my projects
Dim strSQL As String = "INSERT INTO SDatabase " & _
"(EmployeeName, EmployeeSSN, DoS, Claimant, ServType, ServAmount, Paid, AmountPaid, PayableTo) VALUES(" & _
"'" & params(0) & "'," & _
"'" & params(1) & "'," & _
"'" & params(2) & "'," & _
"'" & params(3) & "'," & _
"'" & params(5) & "'," & _
"'" & params(4) & "'," & _
"'" & params(6) & "'," & _
"'" & params(7) & "'," & _
"'" & params(8) & "')"
ExecuteStatement(strSQL)
Conn.Close()
Conn2.Close()
End Sub
Function ExecuteStatement(ByVal strSQL)
Dim objCmd As New OleDbCommand(strSQL, Conn)
Try
objCmd.Connection.Open()
objCmd.ExecuteNonQuery()
Catch ex As Exception
Label1.Text = "Error updating the database"
End Try
Label1.Text = "SUCCESS"
objCmd.Connection.Close()
Response.Redirect("index.a spx")
End Function
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName) values("'" & CRLastName & "'," & "'" & CRFirstName & "')"
con.Execute (sql_insert)
Below is a sample of one of my projects
Dim strSQL As String = "INSERT INTO SDatabase " & _
"(EmployeeName, EmployeeSSN, DoS, Claimant, ServType, ServAmount, Paid, AmountPaid, PayableTo) VALUES(" & _
"'" & params(0) & "'," & _
"'" & params(1) & "'," & _
"'" & params(2) & "'," & _
"'" & params(3) & "'," & _
"'" & params(5) & "'," & _
"'" & params(4) & "'," & _
"'" & params(6) & "'," & _
"'" & params(7) & "'," & _
"'" & params(8) & "')"
ExecuteStatement(strSQL)
Conn.Close()
Conn2.Close()
End Sub
Function ExecuteStatement(ByVal strSQL)
Dim objCmd As New OleDbCommand(strSQL, Conn)
Try
objCmd.Connection.Open()
objCmd.ExecuteNonQuery()
Catch ex As Exception
Label1.Text = "Error updating the database"
End Try
Label1.Text = "SUCCESS"
objCmd.Connection.Close()
Response.Redirect("index.a
End Function
ASKER
I tried both suggestions, and still not working. I'm receiving this error:
Microsoft JScript compilation error '800a03ec'
Expected ';'
/ConfReg2006_New.asp, line 4
Dim sql_insert, con
Microsoft JScript compilation error '800a03ec'
Expected ';'
/ConfReg2006_New.asp, line 4
Dim sql_insert, con
ok you are using C#, you have to have ; at the end of your lines, code should be:
<%
Dim sql_insert, con;
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName)values('CRLast Name','CRF irstName') ";
con.Execute (sql_insert);
%>
if that doesn't work try this
<%
Dim sql_insert, con;
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName) values("'" & CRLastName & "'," & "'" & CRFirstName & "')";
con.Execute (sql_insert);
%>
if the "sql_insert =" line goes too far and over to the line below you have to make sure that the end of the top line has this & _
like this:
"THis line is too " & _
" long";
<%
Dim sql_insert, con;
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName)values('CRLast
con.Execute (sql_insert);
%>
if that doesn't work try this
<%
Dim sql_insert, con;
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName) values("'" & CRLastName & "'," & "'" & CRFirstName & "')";
con.Execute (sql_insert);
%>
if the "sql_insert =" line goes too far and over to the line below you have to make sure that the end of the top line has this & _
like this:
"THis line is too " & _
" long";
Ok, ummm NOOOOOOO!
Compuken:
1. He's not using C#, it's an asp page. (Your first code snippet wasn't even VBScript - it was VB.Net)
2. You do NOT just add semicolons to convert vbscript to c# even if it was c#.
3. It should have been obvious the runtime environment was trying to execute JScript since that's what his error was.
4. There is no line continuation in either c# or JScript since it's built in (hence the need for semicolons).
5. Neither language (C# or JScript) use DIM for variable declaration
DUDE!!!! Just stop! Please!!!
Lazzydog,
Are you wanting to write VBScript? That's what it looks like. If so check to make sure your page has the correct directive at the very top of the page. It should look like this:
<%@ Language=VBScript %>
You will need to instantiate and open your "con" object before you can use it to execute.
I'm assuming CRLastName and CRFirstName are the names of the textboxes on the page that posts to this page?
If so, the following code will fix you up, if not, let me know. This is a very simple task that can be fixed quickly.
<%
Dim sql_insert, con, LN, FN
SET con = Server.CreateObject("adodb .connectio n")
'The following connection string assumes SQL server and that it exists on your machine
'It will need to be changed to point to the database you are trying to connect to.
con.Open "PROVIDER=SQLOLEDB;DATA SOURCE=(local);INITIAL CATALOG=YourDatabaseName;U SER ID=sa;PASSWORD="
LN = Replace(Request("CRLastNam e"),"'","' '")
FN = Replace(Request("CRFirstNa me"),"'"," ''")
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName) values( '" & LN & "','" & FN & "' )"
con.Execute (sql_insert)
con.close
SET con = Nothing
%>
Compuken:
1. He's not using C#, it's an asp page. (Your first code snippet wasn't even VBScript - it was VB.Net)
2. You do NOT just add semicolons to convert vbscript to c# even if it was c#.
3. It should have been obvious the runtime environment was trying to execute JScript since that's what his error was.
4. There is no line continuation in either c# or JScript since it's built in (hence the need for semicolons).
5. Neither language (C# or JScript) use DIM for variable declaration
DUDE!!!! Just stop! Please!!!
Lazzydog,
Are you wanting to write VBScript? That's what it looks like. If so check to make sure your page has the correct directive at the very top of the page. It should look like this:
<%@ Language=VBScript %>
You will need to instantiate and open your "con" object before you can use it to execute.
I'm assuming CRLastName and CRFirstName are the names of the textboxes on the page that posts to this page?
If so, the following code will fix you up, if not, let me know. This is a very simple task that can be fixed quickly.
<%
Dim sql_insert, con, LN, FN
SET con = Server.CreateObject("adodb
'The following connection string assumes SQL server and that it exists on your machine
'It will need to be changed to point to the database you are trying to connect to.
con.Open "PROVIDER=SQLOLEDB;DATA SOURCE=(local);INITIAL CATALOG=YourDatabaseName;U
LN = Replace(Request("CRLastNam
FN = Replace(Request("CRFirstNa
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName) values( '" & LN & "','" & FN & "' )"
con.Execute (sql_insert)
con.close
SET con = Nothing
%>
ASKER
ummm actually I'm using JAVAScript
At top of my page looks like this:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
At top of my page looks like this:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
ASKER
trainsdse,
Does the code above works with JAVASCRIPT?
Does the code above works with JAVASCRIPT?
Nope, but gimme 5 minutes and I'll resend in javascript.
<%
var sql_insert, con;
var LN=new String(Request("CRLastName "));
var FN=new String(Request("CRFirstNam e"));
con = new ActiveXObject("adodb.conne ction");
try{
//'The following connection string assumes SQL server and that it exists on your machine
//'It will need to be changed to point to the database you are trying to connect to.
con.Open("PROVIDER=SQLOLED B;DATA SOURCE=(local);INITIAL CATALOG=lemdev;USER ID=sa;PASSWORD=");
var repChars="''";
LN = LN.replace(/\'/g,repChars) ;
FN = FN.replace(/\'/g,repChars) ;
}catch(e){
Response.Write(e.message);
Response.End();
}
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName) values( '" + LN + "','" + FN + "' )";
con.Execute (sql_insert);
con.Close();
con=null;
%>
Tested on my machine and works well.
var sql_insert, con;
var LN=new String(Request("CRLastName
var FN=new String(Request("CRFirstNam
con = new ActiveXObject("adodb.conne
try{
//'The following connection string assumes SQL server and that it exists on your machine
//'It will need to be changed to point to the database you are trying to connect to.
con.Open("PROVIDER=SQLOLED
var repChars="''";
LN = LN.replace(/\'/g,repChars)
FN = FN.replace(/\'/g,repChars)
}catch(e){
Response.Write(e.message);
Response.End();
}
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName) values( '" + LN + "','" + FN + "' )";
con.Execute (sql_insert);
con.Close();
con=null;
%>
Tested on my machine and works well.
ASKER
Thanks, I'll try it tomorrow.
For this part would I write it like this, since I didn't set a password for my database?
con.Open("PROVIDER=SQLOLED B;DATA SOURCE="C:\Inetpub\wwroot\ mnawwa\Dat abase\Conf Reg06.mdb" ;INITIAL CATALOG=lemdev");
For this part would I write it like this, since I didn't set a password for my database?
con.Open("PROVIDER=SQLOLED
It would be:
con.Open("PROVIDER=Microso ft.Jet.OLE DB.4.0;DAT A SOURCE=C:\\Inetpub\\wwroot \\mnawwa\\ Database\\ ConfReg06. mdb");
con.Open("PROVIDER=Microso
ASKER
Looks like it's almost working, in my access table instead of inserting the data I entered on my form it's inserted "underfined" for both CRLastName and CRFirstName columns. Do you have any ideas why?Thanks.
can you post the html of the page?
ASKER
Sure, the code of my asp form page: Thanks.
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/connConf Reg06.asp" -->
<%
var sql_insert, con;
var LN=new String(Request("CRLastName "));
var FN=new String(Request("CRFirstNam e"));
con = new ActiveXObject("adodb.conne ction");
try{
//'The following connection string assumes SQL server and that it exists on your machine
//'It will need to be changed to point to the database you are trying to connect to.
con.Open("PROVIDER=Microso ft.Jet.OLE DB.4.0;DAT A SOURCE=C:\\Inetpub\\wwwroo t\\mnawwa\ \Database\ \ConfReg06 .mdb");
var repChars="''";
LN = LN.replace(/\'/g,repChars) ;
FN = FN.replace(/\'/g,repChars) ;
}catch(e){
Response.Write(e.message);
Response.End();
}
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName) values( '" + LN + "','" + FN + "' )";
con.Execute (sql_insert);
con.Close();
con=null;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<style type="text/css">
<!--
.style1 {
font-family: "Times New Roman", Times, serif;
font-size: 14px;
}
.style7 {font-family: "Times New Roman", Times, serif; font-size: 14px; font-weight: bold; }
.style10 {
font-size: 14px;
font-weight: bold;
}
.style11 {font-family: "Times New Roman", Times, serif}
.style13 {
color: #000000;
font-family: "Times New Roman", Times, serif;
font-size: 24px;
}
.style14 {color: #000000}
.style16 {
color: #000000;
font-style: italic;
font-size: 18px;
}
.style17 {
font-size: 14px;
font-style: italic;
}
.style19 {font-family: "Times New Roman", Times, serif; font-size: 14px; font-style: italic; }
.style20 {color: #FF0000}
-->
</style>
</head>
</html>
<html>
<head>
<title>MN Awwa Conference Online Registration</title>
<script language="javascript">
<!--
function Disabler(){
if(document.frmRegistratio n.RegType[ 0].checked == true){
document.frmRegistration.C ROneDayWed .disabled = true;
document.frmRegistration.C ROneDayThu r.disabled = true;
document.frmRegistration.C ROneDayFri .disabled = true;
document.frmRegistration.C RRegular.d isabled = false;
document.frmRegistration.C RRetiree.d isabled = false;
document.frmRegistration.C RStuWed.di sabled = true;
document.frmRegistration.C RStuThur.d isabled = true;
document.frmRegistration.C RStuFri.di sabled = true;
}
if(document.frmRegistratio n.RegType[ 1].checked == true){
document.frmRegistration.C ROneDayWed .disabled = false;
document.frmRegistration.C ROneDayThu r.disabled = false;
document.frmRegistration.C ROneDayFri .disabled = false;
document.frmRegistration.C RRegular.d isabled = true;
document.frmRegistration.C RRetiree.d isabled = true;
document.frmRegistration.C RStuWed.di sabled = true;
document.frmRegistration.C RStuThur.d isabled = true;
document.frmRegistration.C RStuFri.di sabled = true;
}
if(document.frmRegistratio n.RegType[ 2].checked == true){
document.frmRegistration.C ROneDayWed .disabled = true;
document.frmRegistration.C ROneDayThu r.disabled = true;
document.frmRegistration.C ROneDayFri .disabled = true;
document.frmRegistration.C RRegular.d isabled = true;
document.frmRegistration.C RRetiree.d isabled = true;
document.frmRegistration.C RStuWed.di sabled = false;
document.frmRegistration.C RStuThur.d isabled = false;
document.frmRegistration.C RStuFri.di sabled = false;
}
}
function asMoney(num) {
num = num.toString().replace(/\$ |\,/g,'');
if(isNaN(num)) num = "0";
cents = Math.floor((num*100+0.5)%1 00);
num = Math.floor(num).toString() ;
if(cents < 10) cents = "0" + cents;
return (num + '.' + cents);
}
function calcRegularRegistration() {
var Regular = asMoney(0.00)
if (document.frmRegistration. CRRegular. checked){
var prereg =180.00
Regular = asMoney(prereg)
}
else {
Regular = " "
}
return Regular
}
function calcRetireeRegistration() {
var Retiree = asMoney(0.00)
if (document.frmRegistration. CRRetiree. checked){
var prereg =55.00
Retiree = asMoney(prereg)
}
else {
Retiree = " "
}
return Retiree
}
function calcOneDayWed() {
var OneWed = asMoney(0.00)
if (document.frmRegistration. CROneDayWe d.checked) {
var prereg =80.00
OneWed = asMoney(prereg)
}
else {
OneWed = " "
}
return OneWed
}
function calcOneDayThur() {
var OneThur = asMoney(0.00)
if (document.frmRegistration. CROneDayTh ur.checked ){
var prereg =80.00
OneThur = asMoney(prereg)
}
else {
OneThur = " "
}
return OneThur
}
function calcOneDayFri() {
var OneFri = asMoney(0.00)
if (document.frmRegistration. CROneDayFr i.checked) {
var prereg =80.00
OneFri = asMoney(prereg)
}
else {
OneFri = " "
}
return OneFri
}
function calcStudentWed() {
var StuWed = asMoney(0.00)
if (document.frmRegistration. CRStuWed.c hecked){
var prereg =10.00
StuWed = asMoney(prereg)
}
else {
StuWed = " "
}
return StuWed
}
function calcStudentThur() {
var StuThur = asMoney(0.00)
if (document.frmRegistration. CRStuThur. checked){
var prereg =10.00
StuThur = asMoney(prereg)
}
else {
StuThur = " "
}
return StuThur
}
function calcStudentFri() {
var StuFri = asMoney(0.00)
if (document.frmRegistration. CRStuFri.c hecked){
var prereg =10.00
StuFri = asMoney(prereg)
}
else {
StuFri = " "
}
return StuFri
}
function calcGuest() {
var Guest = asMoney(0.00)
if (document.frmRegistration. CRGuest.ch ecked){
var prereg =55.00
Guest = asMoney(prereg)
}
else {
Guest = " "
}
return Guest
}
function calcticket() {
if (document.frmRegistration. CRTicket.v alue==1) {
tick = document.frmRegistration.C RTicket.va lue*30
}
else{
tick = document.frmRegistration.C RTicket.va lue*30
}
return tick
}
function showname() {
if (document.frmRegistration. CRFirstNam e.value) {
tick = document.frmRegistration.C RFirstName .value
}
else{
tick = document.frmRegistration.C RFirstName .value
}
return tick
}
function calcFinalTot() {
var gtot=document.frmRegistrat ion.x_regu lar.value* 1+document .frmRegist ration.x_r etiree.val ue*1+docum ent.frmReg istration. x_onewed.v alue*1+doc ument.frmR egistratio n.x_onethu r.value*1+ document.f rmRegistra tion.x_one fri.value* 1+document .frmRegist ration.x_s tuwed.valu e*1+docume nt.frmRegi stration.x _stuthur.v alue*1+doc ument.frmR egistratio n.x_stufri .value*1+d ocument.fr mRegistrat ion.x_gues t.value*1+ document.f rmRegistra tion.x_tic ket.value* 1
var grandtot=asMoney(gtot)
return grandtot
}
function CheckRegisration() {
document.frmRegistration.x _regular.v alue = calcRegularRegistration()
document.frmRegistration.x _retiree.v alue = calcRetireeRegistration()
document.frmRegistration.x _onewed.va lue = calcOneDayWed()
document.frmRegistration.x _onethur.v alue = calcOneDayThur()
document.frmRegistration.x _onefri.va lue = calcOneDayFri()
document.frmRegistration.x _stuwed.va lue = calcStudentWed()
document.frmRegistration.x _stuthur.v alue = calcStudentThur()
document.frmRegistration.x _stufri.va lue = calcStudentFri()
document.frmRegistration.x _guest.val ue = calcGuest()
document.frmRegistration.x _ticket.va lue = calcticket()
document.frmRegistration.x _show.valu e = showname()
document.frmRegistration.x _Amount.va lue = calcFinalTot()
return 0
}
//-->
</script>
</head>
<body TOPMARGIN="1" LEFTMARGIN="1" RIGHTMARGIN="0" BOTTOMMARGIN="0">
<LINK rel="stylesheet" type="text/css" href="/includes/NationalSt yle.css">
<LINK REL="SHORTCUT ICON" HREF="/favicon.ico">
<span id="noprint_header">
<!-- BEGIN: HEADER -->
<!-- END: HEADER -->
</span>
<form action="ConfReg2006Confirm .asp" method="post" name="frmRegistration">
<p align="center" class="style20" style="margin-top: 0; margin-bottom: 0">PAGE UNDER CONSTRUCTION!!! </p>
<p align="center" class="style13"> </p>
<p align="center"> </p>
<table cellpadding="10" cellspacing="0" width="103%" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td class="Groovy"><p> <font face="Times New Roman">First Name:
<input name="CRFirstName" type="text" id="CRFirstName" size="20" />
</font><font face="Times New Roman"> Last Name:
<input name="CRLastName" type="text" id="CRLastName" size="20">
Title:
<input name="CRTitle" type="text" id="CRTitle" size="30">
</font></p>
<p><font face="Times New Roman">Employer:
<input name="CREmployer" type="text" id="CREmployer" size="45">
</font></p>
<p><font face="Times New Roman">Street Address:
<input name="CRAddress" type="text" id="CRAddress" size="35">
</font><font face="Times New Roman"> City:
<input name="CRCity" type="text" id="CRCity" size="20" />
State:
<input name="CRState" type="text" id="CRState" size="10">
Zip:
<input name="CRZip" type="text" id="CRZip" size="9">
</font></p>
<p><font face="Times New Roman">Phone:
<input name="CRPhone" type="text" id="CRPhone" size="11">
</font><font face="Times New Roman"> Fax:
<input name="CRFax" type="text" id="CRFax" size="11">
Email:
<input name="CREmail" type="text" id="CREmail" size="30">
</font></p>
<p><font face="Times New Roman">Please send me information about the Vendor
Exhibition
<input name="CRVendor" type="checkbox" id="CRVendor" value="ON">
</font></p>
<table width="744" border="0">
<tr>
<td width="194"><span style="margin-top: 0"> <font face="Times New Roman">Are you an AWWA member?</font></span></td>
<td width="36"><font face="Times New Roman">Yes</font></td>
<td width="500"><font face="Times New Roman">
<input type="radio" value="Member" checked="checked" name="radmember" />
Member Number:
<input name="CRMemberNum" type="text" id="CRMemberNum" size="9" />
</font></td>
</tr>
<tr>
<td> </td>
<td><font face="Times New Roman">No</font></td>
<td><font face="Times New Roman">
<input type="radio" name="radmember" value="Not Member" />
</font></td>
</tr>
</table>
<p align="center"><b><font face="Times New Roman" size="5">Registration
Information</font></b></p>
<table cellpadding="0" cellspacing="0" width="82%">
<tr>
<td colspan="2"><pre class="style1"><input type="radio" name="RegType" value="FULL" onclick="javascript:Disabl er();" checked><b>Full Registration
</b><i>Includes all conference technical sessions, Wednesday, Thursday, and Friday luncheons, Wednesday evening social, and Thursday <br />evening banquet</i><label></label> </pre> </td>
</tr>
<tr>
<td><span class="style1">
<label>
<input name="CRRegular" type="checkbox" id="CRRegular" value="Regular" />
</label>
Regular </span></td>
<td>$180 <span class="style1">($230 after 9/13/2006) </span></td>
</tr>
<tr>
<td width="22%"><span class="style1"><i><i>
<label>
<input name="CRRetiree" type="checkbox" id="CRRetiree" value="Retiree" />
</label>
</i></i>Retiree </span></td>
<td width="78%">$55</td>
</tr>
<tr>
<td colspan="2"><div style="">
<pre><font face="Times New Roman">
<input type="radio" name="RegType" value="ONE_DAY" onclick="javascript:Disabl er();" /><span class="style7">One-Day Registration</span></font>
<span class="style19"><font face="Times New Roman">Includes all conference technical sessions for that day and one </font></span><span class="style17"><font face="Times New Roman">luncheon</font></sp an><span class="style19"><font face="Times New Roman"> ticket </font></span></pre>
</div></td>
</tr>
<tr>
<td colspan="2"><table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><font face="Times New Roman">
<input name="CROneDayWed" type="checkbox" id="CROneDayWed" value="One_Day Wednesday" />
Wednesday </font></td>
<td>$80 <span class="style1">($110 after 9/13/2006) </span></td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CROneDayThur" type="checkbox" id="CROneDayThur" value="One-Day Thursday" />
Thursday </font></td>
<td>$80 <span class="style1">($110 after 9/13/2006) </span></td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CROneDayFri" type="checkbox" id="CROneDayFri" value="One-Day Friday" />
Friday </font></td>
<td>$80 <span class="style1">($110 after 9/13/2006) </span></td>
</tr>
<tr>
<td colspan="2"><pre><font face="Times New Roman"><span class="style1">
<input type="radio" name="RegType" value="ONE_DAY" onclick="javascript:Disabl er();" /><b>Student Registration</b></span></f ont>
<span class="style1"><em>Must be enrolled in an educational institution at least half time. Includes technical sessions and lunch for registered date(s). </em></span></pre> </td>
</tr>
<tr>
<td width="22%"><font face="Times New Roman">
<input name="CRStuWed" type="checkbox" id="CRStuWed" value="Student - Wednesday" />
Wednesday </font></td>
<td width="78%">$10</td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CRStuThur" type="checkbox" id="CRStuThur" value="Student Thursday" />
Thursday </font></td>
<td>$10</td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CRStuFri" type="checkbox" id="CRStuFri" value="Student Friday" />
Friday </font></td>
<td>$10</td>
</tr>
</table>
<pre style="margin-bottom: 0"><span class="style1"><input name="CRGuest" type="checkbox" id="CRGuest" value="Guest Registraion:"><b>Guest/Spo use Program</b><i>
Includes conference activities, entrance to Vendor Exhibition, continental breakfasts, Wednesday Evening social, <br />and Thursday banquet</i></span></pre> </td>
</tr>
<tr>
<td><span class="style1"> Name:
<input name="GuestName" type="text" id="GuestName" value="" size="25" maxlength="40" />
</span></td>
<td class="style11">$55</td>
</tr>
<tr>
<td colspan="2"><pre class="style10"><font face="Times New Roman">
Additional Ticket(s) for Thursday Banquet</font></pre> </td>
</tr>
<tr>
<td>Quantity: <b><font face="Times New Roman">
<select name="CRTicket" id="CRTicket">
<option value="0" selected>0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</font></b></td>
<td class="style11">$30</td>
</tr>
<tr>
<td colspan="2"><pre class="style10"><label></l abel>
</pre></td>
</tr>
</table></td>
</tr>
</table>
<p align="center"> <i> <font face="Bookman Old Style" size="2">   ; &nb sp; & nbsp;  ; &nb sp; & nbsp;
<input type="reset" value="Reset" name="B2" />
&n bsp;
<input name="Submit" type="submit" onclick="CheckRegisration( )" value="Submit" />
</a></font></i><br />
</p>
<p>
<input name="x_regular" type="hidden" id="x_regular" />
<input name="x_retiree" type="hidden" id="x_retiree" />
<input name="x_onewed" type="hidden" id="x_onewed" />
<input name="x_onethur" type="hidden" id="x_onethur" />
<input name="x_onefri" type="hidden" id="x_onefri" />
<input name="x_stuwed" type="hidden" id="x_stuwed" />
<input name="x_stuthur" type="hidden" id="x_stuthur" />
<input name="x_stufri" type="hidden" id="x_stufri" />
<input name="x_guest" type="hidden" id="x_guest" />
<input name="x_ticket" type="hidden" id="x_ticket" />
<input name="x_Amount" type="hidden" id="x_Amount" />
<input name="x_show" type="hidden" id="x_show" />
</p>
</form>
<script language="javascript">
<!--
Disabler();
//-->
</script>
</td>
</tr>
<!-- End code -->
<!-- located here for compatibility, fresh code/fixing code please direct to: -->
<span id="noprint_footer">
<!-- BEGIN: FOOTER -->
<!-- END: FOOTER -->
</span>
</td>
</body>
</html>
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/connConf
<%
var sql_insert, con;
var LN=new String(Request("CRLastName
var FN=new String(Request("CRFirstNam
con = new ActiveXObject("adodb.conne
try{
//'The following connection string assumes SQL server and that it exists on your machine
//'It will need to be changed to point to the database you are trying to connect to.
con.Open("PROVIDER=Microso
var repChars="''";
LN = LN.replace(/\'/g,repChars)
FN = FN.replace(/\'/g,repChars)
}catch(e){
Response.Write(e.message);
Response.End();
}
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName) values( '" + LN + "','" + FN + "' )";
con.Execute (sql_insert);
con.Close();
con=null;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<style type="text/css">
<!--
.style1 {
font-family: "Times New Roman", Times, serif;
font-size: 14px;
}
.style7 {font-family: "Times New Roman", Times, serif; font-size: 14px; font-weight: bold; }
.style10 {
font-size: 14px;
font-weight: bold;
}
.style11 {font-family: "Times New Roman", Times, serif}
.style13 {
color: #000000;
font-family: "Times New Roman", Times, serif;
font-size: 24px;
}
.style14 {color: #000000}
.style16 {
color: #000000;
font-style: italic;
font-size: 18px;
}
.style17 {
font-size: 14px;
font-style: italic;
}
.style19 {font-family: "Times New Roman", Times, serif; font-size: 14px; font-style: italic; }
.style20 {color: #FF0000}
-->
</style>
</head>
</html>
<html>
<head>
<title>MN Awwa Conference Online Registration</title>
<script language="javascript">
<!--
function Disabler(){
if(document.frmRegistratio
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
}
if(document.frmRegistratio
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
}
if(document.frmRegistratio
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
}
}
function asMoney(num) {
num = num.toString().replace(/\$
if(isNaN(num)) num = "0";
cents = Math.floor((num*100+0.5)%1
num = Math.floor(num).toString()
if(cents < 10) cents = "0" + cents;
return (num + '.' + cents);
}
function calcRegularRegistration() {
var Regular = asMoney(0.00)
if (document.frmRegistration.
var prereg =180.00
Regular = asMoney(prereg)
}
else {
Regular = " "
}
return Regular
}
function calcRetireeRegistration() {
var Retiree = asMoney(0.00)
if (document.frmRegistration.
var prereg =55.00
Retiree = asMoney(prereg)
}
else {
Retiree = " "
}
return Retiree
}
function calcOneDayWed() {
var OneWed = asMoney(0.00)
if (document.frmRegistration.
var prereg =80.00
OneWed = asMoney(prereg)
}
else {
OneWed = " "
}
return OneWed
}
function calcOneDayThur() {
var OneThur = asMoney(0.00)
if (document.frmRegistration.
var prereg =80.00
OneThur = asMoney(prereg)
}
else {
OneThur = " "
}
return OneThur
}
function calcOneDayFri() {
var OneFri = asMoney(0.00)
if (document.frmRegistration.
var prereg =80.00
OneFri = asMoney(prereg)
}
else {
OneFri = " "
}
return OneFri
}
function calcStudentWed() {
var StuWed = asMoney(0.00)
if (document.frmRegistration.
var prereg =10.00
StuWed = asMoney(prereg)
}
else {
StuWed = " "
}
return StuWed
}
function calcStudentThur() {
var StuThur = asMoney(0.00)
if (document.frmRegistration.
var prereg =10.00
StuThur = asMoney(prereg)
}
else {
StuThur = " "
}
return StuThur
}
function calcStudentFri() {
var StuFri = asMoney(0.00)
if (document.frmRegistration.
var prereg =10.00
StuFri = asMoney(prereg)
}
else {
StuFri = " "
}
return StuFri
}
function calcGuest() {
var Guest = asMoney(0.00)
if (document.frmRegistration.
var prereg =55.00
Guest = asMoney(prereg)
}
else {
Guest = " "
}
return Guest
}
function calcticket() {
if (document.frmRegistration.
tick = document.frmRegistration.C
}
else{
tick = document.frmRegistration.C
}
return tick
}
function showname() {
if (document.frmRegistration.
tick = document.frmRegistration.C
}
else{
tick = document.frmRegistration.C
}
return tick
}
function calcFinalTot() {
var gtot=document.frmRegistrat
var grandtot=asMoney(gtot)
return grandtot
}
function CheckRegisration() {
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
return 0
}
//-->
</script>
</head>
<body TOPMARGIN="1" LEFTMARGIN="1" RIGHTMARGIN="0" BOTTOMMARGIN="0">
<LINK rel="stylesheet" type="text/css" href="/includes/NationalSt
<LINK REL="SHORTCUT ICON" HREF="/favicon.ico">
<span id="noprint_header">
<!-- BEGIN: HEADER -->
<!-- END: HEADER -->
</span>
<form action="ConfReg2006Confirm
<p align="center" class="style20" style="margin-top: 0; margin-bottom: 0">PAGE UNDER CONSTRUCTION!!! </p>
<p align="center" class="style13"> </p>
<p align="center"> </p>
<table cellpadding="10" cellspacing="0" width="103%" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td class="Groovy"><p> <font face="Times New Roman">First Name:
<input name="CRFirstName" type="text" id="CRFirstName" size="20" />
</font><font face="Times New Roman"> Last Name:
<input name="CRLastName" type="text" id="CRLastName" size="20">
Title:
<input name="CRTitle" type="text" id="CRTitle" size="30">
</font></p>
<p><font face="Times New Roman">Employer:
<input name="CREmployer" type="text" id="CREmployer" size="45">
</font></p>
<p><font face="Times New Roman">Street Address:
<input name="CRAddress" type="text" id="CRAddress" size="35">
</font><font face="Times New Roman"> City:
<input name="CRCity" type="text" id="CRCity" size="20" />
State:
<input name="CRState" type="text" id="CRState" size="10">
Zip:
<input name="CRZip" type="text" id="CRZip" size="9">
</font></p>
<p><font face="Times New Roman">Phone:
<input name="CRPhone" type="text" id="CRPhone" size="11">
</font><font face="Times New Roman"> Fax:
<input name="CRFax" type="text" id="CRFax" size="11">
Email:
<input name="CREmail" type="text" id="CREmail" size="30">
</font></p>
<p><font face="Times New Roman">Please send me information about the Vendor
Exhibition
<input name="CRVendor" type="checkbox" id="CRVendor" value="ON">
</font></p>
<table width="744" border="0">
<tr>
<td width="194"><span style="margin-top: 0"> <font face="Times New Roman">Are you an AWWA member?</font></span></td>
<td width="36"><font face="Times New Roman">Yes</font></td>
<td width="500"><font face="Times New Roman">
<input type="radio" value="Member" checked="checked" name="radmember" />
Member Number:
<input name="CRMemberNum" type="text" id="CRMemberNum" size="9" />
</font></td>
</tr>
<tr>
<td> </td>
<td><font face="Times New Roman">No</font></td>
<td><font face="Times New Roman">
<input type="radio" name="radmember" value="Not Member" />
</font></td>
</tr>
</table>
<p align="center"><b><font face="Times New Roman" size="5">Registration
Information</font></b></p>
<table cellpadding="0" cellspacing="0" width="82%">
<tr>
<td colspan="2"><pre class="style1"><input type="radio" name="RegType" value="FULL" onclick="javascript:Disabl
</b><i>Includes all conference technical sessions, Wednesday, Thursday, and Friday luncheons, Wednesday evening social, and Thursday <br />evening banquet</i><label></label>
</tr>
<tr>
<td><span class="style1">
<label>
<input name="CRRegular" type="checkbox" id="CRRegular" value="Regular" />
</label>
Regular </span></td>
<td>$180 <span class="style1">($230 after 9/13/2006) </span></td>
</tr>
<tr>
<td width="22%"><span class="style1"><i><i>
<label>
<input name="CRRetiree" type="checkbox" id="CRRetiree" value="Retiree" />
</label>
</i></i>Retiree </span></td>
<td width="78%">$55</td>
</tr>
<tr>
<td colspan="2"><div style="">
<pre><font face="Times New Roman">
<input type="radio" name="RegType" value="ONE_DAY" onclick="javascript:Disabl
<span class="style19"><font face="Times New Roman">Includes all conference technical sessions for that day and one </font></span><span class="style17"><font face="Times New Roman">luncheon</font></sp
</div></td>
</tr>
<tr>
<td colspan="2"><table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><font face="Times New Roman">
<input name="CROneDayWed" type="checkbox" id="CROneDayWed" value="One_Day Wednesday" />
Wednesday </font></td>
<td>$80 <span class="style1">($110 after 9/13/2006) </span></td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CROneDayThur" type="checkbox" id="CROneDayThur" value="One-Day Thursday" />
Thursday </font></td>
<td>$80 <span class="style1">($110 after 9/13/2006) </span></td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CROneDayFri" type="checkbox" id="CROneDayFri" value="One-Day Friday" />
Friday </font></td>
<td>$80 <span class="style1">($110 after 9/13/2006) </span></td>
</tr>
<tr>
<td colspan="2"><pre><font face="Times New Roman"><span class="style1">
<input type="radio" name="RegType" value="ONE_DAY" onclick="javascript:Disabl
<span class="style1"><em>Must be enrolled in an educational institution at least half time. Includes technical sessions and lunch for registered date(s). </em></span></pre> </td>
</tr>
<tr>
<td width="22%"><font face="Times New Roman">
<input name="CRStuWed" type="checkbox" id="CRStuWed" value="Student - Wednesday" />
Wednesday </font></td>
<td width="78%">$10</td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CRStuThur" type="checkbox" id="CRStuThur" value="Student Thursday" />
Thursday </font></td>
<td>$10</td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CRStuFri" type="checkbox" id="CRStuFri" value="Student Friday" />
Friday </font></td>
<td>$10</td>
</tr>
</table>
<pre style="margin-bottom: 0"><span class="style1"><input name="CRGuest" type="checkbox" id="CRGuest" value="Guest Registraion:"><b>Guest/Spo
Includes conference activities, entrance to Vendor Exhibition, continental breakfasts, Wednesday Evening social, <br />and Thursday banquet</i></span></pre> </td>
</tr>
<tr>
<td><span class="style1"> Name:
<input name="GuestName" type="text" id="GuestName" value="" size="25" maxlength="40" />
</span></td>
<td class="style11">$55</td>
</tr>
<tr>
<td colspan="2"><pre class="style10"><font face="Times New Roman">
Additional Ticket(s) for Thursday Banquet</font></pre> </td>
</tr>
<tr>
<td>Quantity: <b><font face="Times New Roman">
<select name="CRTicket" id="CRTicket">
<option value="0" selected>0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</font></b></td>
<td class="style11">$30</td>
</tr>
<tr>
<td colspan="2"><pre class="style10"><label></l
</pre></td>
</tr>
</table></td>
</tr>
</table>
<p align="center"> <i> <font face="Bookman Old Style" size="2">  
<input type="reset" value="Reset" name="B2" />
&n
<input name="Submit" type="submit" onclick="CheckRegisration(
</a></font></i><br />
</p>
<p>
<input name="x_regular" type="hidden" id="x_regular" />
<input name="x_retiree" type="hidden" id="x_retiree" />
<input name="x_onewed" type="hidden" id="x_onewed" />
<input name="x_onethur" type="hidden" id="x_onethur" />
<input name="x_onefri" type="hidden" id="x_onefri" />
<input name="x_stuwed" type="hidden" id="x_stuwed" />
<input name="x_stuthur" type="hidden" id="x_stuthur" />
<input name="x_stufri" type="hidden" id="x_stufri" />
<input name="x_guest" type="hidden" id="x_guest" />
<input name="x_ticket" type="hidden" id="x_ticket" />
<input name="x_Amount" type="hidden" id="x_Amount" />
<input name="x_show" type="hidden" id="x_show" />
</p>
</form>
<script language="javascript">
<!--
Disabler();
//-->
</script>
</td>
</tr>
<!-- End code -->
<!-- located here for compatibility, fresh code/fixing code please direct to: -->
<span id="noprint_footer">
<!-- BEGIN: FOOTER -->
<!-- END: FOOTER -->
</span>
</td>
</body>
</html>
Try this page, I added a check for whether or not this page is posting back or if you just came here for the first time. Besides the if statement at the top, there is a new hidden input right after the form starts to support this. Watch out for the word wrap on the data source param in the connection string when you copy this text.
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%
if(Request("postback")=="1 "){
var sql_insert, con;
var LN=new String(Request("CRLastName "));
var FN=new String(Request("CRFirstNam e"));
con = new ActiveXObject("adodb.conne ction");
try{
//'The following connection string assumes SQL server and that it exists on your machine
//'It will need to be changed to point to the database you are trying to connect to.
con.Open("PROVIDER=Microso ft.Jet.OLE DB.4.0;DAT A SOURCE=C:\\Inetpub\\wwwroo t\\mnawwa\ \Database\ \ConfReg06 .mdb");
var repChars="''";
LN = LN.replace(/\'/g,repChars) ;
FN = FN.replace(/\'/g,repChars) ;
}catch(e){
Response.Write(e.message);
Response.End();
}
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName) values( '" + LN + "','" + FN + "' )";
con.Execute (sql_insert);
con.Close();
con=null;
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<style type="text/css">
<!--
.style1 {
font-family: "Times New Roman", Times, serif;
font-size: 14px;
}
.style7 {font-family: "Times New Roman", Times, serif; font-size: 14px; font-weight: bold; }
.style10 {
font-size: 14px;
font-weight: bold;
}
.style11 {font-family: "Times New Roman", Times, serif}
.style13 {
color: #000000;
font-family: "Times New Roman", Times, serif;
font-size: 24px;
}
.style14 {color: #000000}
.style16 {
color: #000000;
font-style: italic;
font-size: 18px;
}
.style17 {
font-size: 14px;
font-style: italic;
}
.style19 {font-family: "Times New Roman", Times, serif; font-size: 14px; font-style: italic; }
.style20 {color: #FF0000}
-->
</style>
</head>
</html>
<html>
<head>
<title>MN Awwa Conference Online Registration</title>
<script language="javascript">
<!--
function Disabler(){
if(document.frmRegistratio n.RegType[ 0].checked == true){
document.frmRegistration.C ROneDayWed .disabled = true;
document.frmRegistration.C ROneDayThu r.disabled = true;
document.frmRegistration.C ROneDayFri .disabled = true;
document.frmRegistration.C RRegular.d isabled = false;
document.frmRegistration.C RRetiree.d isabled = false;
document.frmRegistration.C RStuWed.di sabled = true;
document.frmRegistration.C RStuThur.d isabled = true;
document.frmRegistration.C RStuFri.di sabled = true;
}
if(document.frmRegistratio n.RegType[ 1].checked == true){
document.frmRegistration.C ROneDayWed .disabled = false;
document.frmRegistration.C ROneDayThu r.disabled = false;
document.frmRegistration.C ROneDayFri .disabled = false;
document.frmRegistration.C RRegular.d isabled = true;
document.frmRegistration.C RRetiree.d isabled = true;
document.frmRegistration.C RStuWed.di sabled = true;
document.frmRegistration.C RStuThur.d isabled = true;
document.frmRegistration.C RStuFri.di sabled = true;
}
if(document.frmRegistratio n.RegType[ 2].checked == true){
document.frmRegistration.C ROneDayWed .disabled = true;
document.frmRegistration.C ROneDayThu r.disabled = true;
document.frmRegistration.C ROneDayFri .disabled = true;
document.frmRegistration.C RRegular.d isabled = true;
document.frmRegistration.C RRetiree.d isabled = true;
document.frmRegistration.C RStuWed.di sabled = false;
document.frmRegistration.C RStuThur.d isabled = false;
document.frmRegistration.C RStuFri.di sabled = false;
}
}
function asMoney(num) {
num = num.toString().replace(/\$ |\,/g,'');
if(isNaN(num)) num = "0";
cents = Math.floor((num*100+0.5)%1 00);
num = Math.floor(num).toString() ;
if(cents < 10) cents = "0" + cents;
return (num + '.' + cents);
}
function calcRegularRegistration() {
var Regular = asMoney(0.00)
if (document.frmRegistration. CRRegular. checked){
var prereg =180.00
Regular = asMoney(prereg)
}
else {
Regular = " "
}
return Regular
}
function calcRetireeRegistration() {
var Retiree = asMoney(0.00)
if (document.frmRegistration. CRRetiree. checked){
var prereg =55.00
Retiree = asMoney(prereg)
}
else {
Retiree = " "
}
return Retiree
}
function calcOneDayWed() {
var OneWed = asMoney(0.00)
if (document.frmRegistration. CROneDayWe d.checked) {
var prereg =80.00
OneWed = asMoney(prereg)
}
else {
OneWed = " "
}
return OneWed
}
function calcOneDayThur() {
var OneThur = asMoney(0.00)
if (document.frmRegistration. CROneDayTh ur.checked ){
var prereg =80.00
OneThur = asMoney(prereg)
}
else {
OneThur = " "
}
return OneThur
}
function calcOneDayFri() {
var OneFri = asMoney(0.00)
if (document.frmRegistration. CROneDayFr i.checked) {
var prereg =80.00
OneFri = asMoney(prereg)
}
else {
OneFri = " "
}
return OneFri
}
function calcStudentWed() {
var StuWed = asMoney(0.00)
if (document.frmRegistration. CRStuWed.c hecked){
var prereg =10.00
StuWed = asMoney(prereg)
}
else {
StuWed = " "
}
return StuWed
}
function calcStudentThur() {
var StuThur = asMoney(0.00)
if (document.frmRegistration. CRStuThur. checked){
var prereg =10.00
StuThur = asMoney(prereg)
}
else {
StuThur = " "
}
return StuThur
}
function calcStudentFri() {
var StuFri = asMoney(0.00)
if (document.frmRegistration. CRStuFri.c hecked){
var prereg =10.00
StuFri = asMoney(prereg)
}
else {
StuFri = " "
}
return StuFri
}
function calcGuest() {
var Guest = asMoney(0.00)
if (document.frmRegistration. CRGuest.ch ecked){
var prereg =55.00
Guest = asMoney(prereg)
}
else {
Guest = " "
}
return Guest
}
function calcticket() {
if (document.frmRegistration. CRTicket.v alue==1) {
tick = document.frmRegistration.C RTicket.va lue*30
}
else{
tick = document.frmRegistration.C RTicket.va lue*30
}
return tick
}
function showname() {
if (document.frmRegistration. CRFirstNam e.value) {
tick = document.frmRegistration.C RFirstName .value
}
else{
tick = document.frmRegistration.C RFirstName .value
}
return tick
}
function calcFinalTot() {
var gtot=document.frmRegistrat ion.x_regu lar.value* 1+document .frmRegist ration.x_r etiree.val ue*1+docum ent.frmReg istration. x_onewed.v alue*1+doc ument.frmR egistratio n.x_onethu r.value*1+ document.f rmRegistra tion.x_one fri.value* 1+document .frmRegist ration.x_s tuwed.valu e*1+docume nt.frmRegi stration.x _stuthur.v alue*1+doc ument.frmR egistratio n.x_stufri .value*1+d ocument.fr mRegistrat ion.x_gues t.value*1+ document.f rmRegistra tion.x_tic ket.value* 1
var grandtot=asMoney(gtot)
return grandtot
}
function CheckRegisration() {
document.frmRegistration.x _regular.v alue = calcRegularRegistration()
document.frmRegistration.x _retiree.v alue = calcRetireeRegistration()
document.frmRegistration.x _onewed.va lue = calcOneDayWed()
document.frmRegistration.x _onethur.v alue = calcOneDayThur()
document.frmRegistration.x _onefri.va lue = calcOneDayFri()
document.frmRegistration.x _stuwed.va lue = calcStudentWed()
document.frmRegistration.x _stuthur.v alue = calcStudentThur()
document.frmRegistration.x _stufri.va lue = calcStudentFri()
document.frmRegistration.x _guest.val ue = calcGuest()
document.frmRegistration.x _ticket.va lue = calcticket()
document.frmRegistration.x _show.valu e = showname()
document.frmRegistration.x _Amount.va lue = calcFinalTot()
return 0
}
//-->
</script>
</head>
<body TOPMARGIN="1" LEFTMARGIN="1" RIGHTMARGIN="0" BOTTOMMARGIN="0">
<LINK rel="stylesheet" type="text/css" href="/includes/NationalSt yle.css">
<LINK REL="SHORTCUT ICON" HREF="/favicon.ico">
<span id="noprint_header">
<!-- BEGIN: HEADER -->
<!-- END: HEADER -->
</span>
<form action="ConfReg2006Confirm .asp" method="post" name="frmRegistration">
<input type=hidden name=postback value=1>
<p align="center" class="style20" style="margin-top: 0; margin-bottom: 0">PAGE UNDER CONSTRUCTION!!! </p>
<p align="center" class="style13"> </p>
<p align="center"> </p>
<table cellpadding="10" cellspacing="0" width="103%" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td class="Groovy"><p> <font face="Times New Roman">First Name:
<input name="CRFirstName" type="text" id="CRFirstName" size="20" />
</font><font face="Times New Roman"> Last Name:
<input name="CRLastName" type="text" id="CRLastName" size="20">
Title:
<input name="CRTitle" type="text" id="CRTitle" size="30">
</font></p>
<p><font face="Times New Roman">Employer:
<input name="CREmployer" type="text" id="CREmployer" size="45">
</font></p>
<p><font face="Times New Roman">Street Address:
<input name="CRAddress" type="text" id="CRAddress" size="35">
</font><font face="Times New Roman"> City:
<input name="CRCity" type="text" id="CRCity" size="20" />
State:
<input name="CRState" type="text" id="CRState" size="10">
Zip:
<input name="CRZip" type="text" id="CRZip" size="9">
</font></p>
<p><font face="Times New Roman">Phone:
<input name="CRPhone" type="text" id="CRPhone" size="11">
</font><font face="Times New Roman"> Fax:
<input name="CRFax" type="text" id="CRFax" size="11">
Email:
<input name="CREmail" type="text" id="CREmail" size="30">
</font></p>
<p><font face="Times New Roman">Please send me information about the Vendor
Exhibition
<input name="CRVendor" type="checkbox" id="CRVendor" value="ON">
</font></p>
<table width="744" border="0">
<tr>
<td width="194"><span style="margin-top: 0"> <font face="Times New Roman">Are you an AWWA member?</font></span></td>
<td width="36"><font face="Times New Roman">Yes</font></td>
<td width="500"><font face="Times New Roman">
<input type="radio" value="Member" checked="checked" name="radmember" />
Member Number:
<input name="CRMemberNum" type="text" id="CRMemberNum" size="9" />
</font></td>
</tr>
<tr>
<td> </td>
<td><font face="Times New Roman">No</font></td>
<td><font face="Times New Roman">
<input type="radio" name="radmember" value="Not Member" />
</font></td>
</tr>
</table>
<p align="center"><b><font face="Times New Roman" size="5">Registration
Information</font></b></p>
<table cellpadding="0" cellspacing="0" width="82%">
<tr>
<td colspan="2"><pre class="style1"><input type="radio" name="RegType" value="FULL" onclick="javascript:Disabl er();" checked><b>Full Registration
</b><i>Includes all conference technical sessions, Wednesday, Thursday, and Friday luncheons, Wednesday evening social, and Thursday <br />evening banquet</i><label></label> </pre> </td>
</tr>
<tr>
<td><span class="style1">
<label>
<input name="CRRegular" type="checkbox" id="CRRegular" value="Regular" />
</label>
Regular </span></td>
<td>$180 <span class="style1">($230 after 9/13/2006) </span></td>
</tr>
<tr>
<td width="22%"><span class="style1"><i><i>
<label>
<input name="CRRetiree" type="checkbox" id="CRRetiree" value="Retiree" />
</label>
</i></i>Retiree </span></td>
<td width="78%">$55</td>
</tr>
<tr>
<td colspan="2"><div style="">
<pre><font face="Times New Roman">
<input type="radio" name="RegType" value="ONE_DAY" onclick="javascript:Disabl er();" /><span class="style7">One-Day Registration</span></font>
<span class="style19"><font face="Times New Roman">Includes all conference technical sessions for that day and one </font></span><span class="style17"><font face="Times New Roman">luncheon</font></sp an><span class="style19"><font face="Times New Roman"> ticket </font></span></pre>
</div></td>
</tr>
<tr>
<td colspan="2"><table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><font face="Times New Roman">
<input name="CROneDayWed" type="checkbox" id="CROneDayWed" value="One_Day Wednesday" />
Wednesday </font></td>
<td>$80 <span class="style1">($110 after 9/13/2006) </span></td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CROneDayThur" type="checkbox" id="CROneDayThur" value="One-Day Thursday" />
Thursday </font></td>
<td>$80 <span class="style1">($110 after 9/13/2006) </span></td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CROneDayFri" type="checkbox" id="CROneDayFri" value="One-Day Friday" />
Friday </font></td>
<td>$80 <span class="style1">($110 after 9/13/2006) </span></td>
</tr>
<tr>
<td colspan="2"><pre><font face="Times New Roman"><span class="style1">
<input type="radio" name="RegType" value="ONE_DAY" onclick="javascript:Disabl er();" /><b>Student Registration</b></span></f ont>
<span class="style1"><em>Must be enrolled in an educational institution at least half time. Includes technical sessions and lunch for registered date(s). </em></span></pre> </td>
</tr>
<tr>
<td width="22%"><font face="Times New Roman">
<input name="CRStuWed" type="checkbox" id="CRStuWed" value="Student - Wednesday" />
Wednesday </font></td>
<td width="78%">$10</td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CRStuThur" type="checkbox" id="CRStuThur" value="Student Thursday" />
Thursday </font></td>
<td>$10</td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CRStuFri" type="checkbox" id="CRStuFri" value="Student Friday" />
Friday </font></td>
<td>$10</td>
</tr>
</table>
<pre style="margin-bottom: 0"><span class="style1"><input name="CRGuest" type="checkbox" id="CRGuest" value="Guest Registraion:"><b>Guest/Spo use Program</b><i>
Includes conference activities, entrance to Vendor Exhibition, continental breakfasts, Wednesday Evening social, <br />and Thursday banquet</i></span></pre> </td>
</tr>
<tr>
<td><span class="style1"> Name:
<input name="GuestName" type="text" id="GuestName" value="" size="25" maxlength="40" />
</span></td>
<td class="style11">$55</td>
</tr>
<tr>
<td colspan="2"><pre class="style10"><font face="Times New Roman">
Additional Ticket(s) for Thursday Banquet</font></pre> </td>
</tr>
<tr>
<td>Quantity: <b><font face="Times New Roman">
<select name="CRTicket" id="CRTicket">
<option value="0" selected>0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</font></b></td>
<td class="style11">$30</td>
</tr>
<tr>
<td colspan="2"><pre class="style10"><label></l abel>
</pre></td>
</tr>
</table></td>
</tr>
</table>
<p align="center"> <i> <font face="Bookman Old Style" size="2">   ; &nb sp; & nbsp;  ; &nb sp; & nbsp;
<input type="reset" value="Reset" name="B2" />
&n bsp;
<input name="Submit" type="submit" onclick="CheckRegisration( )" value="Submit" />
</a></font></i><br />
</p>
<p>
<input name="x_regular" type="hidden" id="x_regular" />
<input name="x_retiree" type="hidden" id="x_retiree" />
<input name="x_onewed" type="hidden" id="x_onewed" />
<input name="x_onethur" type="hidden" id="x_onethur" />
<input name="x_onefri" type="hidden" id="x_onefri" />
<input name="x_stuwed" type="hidden" id="x_stuwed" />
<input name="x_stuthur" type="hidden" id="x_stuthur" />
<input name="x_stufri" type="hidden" id="x_stufri" />
<input name="x_guest" type="hidden" id="x_guest" />
<input name="x_ticket" type="hidden" id="x_ticket" />
<input name="x_Amount" type="hidden" id="x_Amount" />
<input name="x_show" type="hidden" id="x_show" />
</p>
</form>
<script language="javascript">
<!--
Disabler();
//-->
</script>
</td>
</tr>
<!-- End code -->
<!-- located here for compatibility, fresh code/fixing code please direct to: -->
<span id="noprint_footer">
<!-- BEGIN: FOOTER -->
<!-- END: FOOTER -->
</span>
</td>
</body>
</html>
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%
if(Request("postback")=="1
var sql_insert, con;
var LN=new String(Request("CRLastName
var FN=new String(Request("CRFirstNam
con = new ActiveXObject("adodb.conne
try{
//'The following connection string assumes SQL server and that it exists on your machine
//'It will need to be changed to point to the database you are trying to connect to.
con.Open("PROVIDER=Microso
var repChars="''";
LN = LN.replace(/\'/g,repChars)
FN = FN.replace(/\'/g,repChars)
}catch(e){
Response.Write(e.message);
Response.End();
}
sql_insert = "insert into ConferenceRegistration (CRLastName, CRFirstName) values( '" + LN + "','" + FN + "' )";
con.Execute (sql_insert);
con.Close();
con=null;
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<style type="text/css">
<!--
.style1 {
font-family: "Times New Roman", Times, serif;
font-size: 14px;
}
.style7 {font-family: "Times New Roman", Times, serif; font-size: 14px; font-weight: bold; }
.style10 {
font-size: 14px;
font-weight: bold;
}
.style11 {font-family: "Times New Roman", Times, serif}
.style13 {
color: #000000;
font-family: "Times New Roman", Times, serif;
font-size: 24px;
}
.style14 {color: #000000}
.style16 {
color: #000000;
font-style: italic;
font-size: 18px;
}
.style17 {
font-size: 14px;
font-style: italic;
}
.style19 {font-family: "Times New Roman", Times, serif; font-size: 14px; font-style: italic; }
.style20 {color: #FF0000}
-->
</style>
</head>
</html>
<html>
<head>
<title>MN Awwa Conference Online Registration</title>
<script language="javascript">
<!--
function Disabler(){
if(document.frmRegistratio
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
}
if(document.frmRegistratio
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
}
if(document.frmRegistratio
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
document.frmRegistration.C
}
}
function asMoney(num) {
num = num.toString().replace(/\$
if(isNaN(num)) num = "0";
cents = Math.floor((num*100+0.5)%1
num = Math.floor(num).toString()
if(cents < 10) cents = "0" + cents;
return (num + '.' + cents);
}
function calcRegularRegistration() {
var Regular = asMoney(0.00)
if (document.frmRegistration.
var prereg =180.00
Regular = asMoney(prereg)
}
else {
Regular = " "
}
return Regular
}
function calcRetireeRegistration() {
var Retiree = asMoney(0.00)
if (document.frmRegistration.
var prereg =55.00
Retiree = asMoney(prereg)
}
else {
Retiree = " "
}
return Retiree
}
function calcOneDayWed() {
var OneWed = asMoney(0.00)
if (document.frmRegistration.
var prereg =80.00
OneWed = asMoney(prereg)
}
else {
OneWed = " "
}
return OneWed
}
function calcOneDayThur() {
var OneThur = asMoney(0.00)
if (document.frmRegistration.
var prereg =80.00
OneThur = asMoney(prereg)
}
else {
OneThur = " "
}
return OneThur
}
function calcOneDayFri() {
var OneFri = asMoney(0.00)
if (document.frmRegistration.
var prereg =80.00
OneFri = asMoney(prereg)
}
else {
OneFri = " "
}
return OneFri
}
function calcStudentWed() {
var StuWed = asMoney(0.00)
if (document.frmRegistration.
var prereg =10.00
StuWed = asMoney(prereg)
}
else {
StuWed = " "
}
return StuWed
}
function calcStudentThur() {
var StuThur = asMoney(0.00)
if (document.frmRegistration.
var prereg =10.00
StuThur = asMoney(prereg)
}
else {
StuThur = " "
}
return StuThur
}
function calcStudentFri() {
var StuFri = asMoney(0.00)
if (document.frmRegistration.
var prereg =10.00
StuFri = asMoney(prereg)
}
else {
StuFri = " "
}
return StuFri
}
function calcGuest() {
var Guest = asMoney(0.00)
if (document.frmRegistration.
var prereg =55.00
Guest = asMoney(prereg)
}
else {
Guest = " "
}
return Guest
}
function calcticket() {
if (document.frmRegistration.
tick = document.frmRegistration.C
}
else{
tick = document.frmRegistration.C
}
return tick
}
function showname() {
if (document.frmRegistration.
tick = document.frmRegistration.C
}
else{
tick = document.frmRegistration.C
}
return tick
}
function calcFinalTot() {
var gtot=document.frmRegistrat
var grandtot=asMoney(gtot)
return grandtot
}
function CheckRegisration() {
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
document.frmRegistration.x
return 0
}
//-->
</script>
</head>
<body TOPMARGIN="1" LEFTMARGIN="1" RIGHTMARGIN="0" BOTTOMMARGIN="0">
<LINK rel="stylesheet" type="text/css" href="/includes/NationalSt
<LINK REL="SHORTCUT ICON" HREF="/favicon.ico">
<span id="noprint_header">
<!-- BEGIN: HEADER -->
<!-- END: HEADER -->
</span>
<form action="ConfReg2006Confirm
<input type=hidden name=postback value=1>
<p align="center" class="style20" style="margin-top: 0; margin-bottom: 0">PAGE UNDER CONSTRUCTION!!! </p>
<p align="center" class="style13"> </p>
<p align="center"> </p>
<table cellpadding="10" cellspacing="0" width="103%" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td class="Groovy"><p> <font face="Times New Roman">First Name:
<input name="CRFirstName" type="text" id="CRFirstName" size="20" />
</font><font face="Times New Roman"> Last Name:
<input name="CRLastName" type="text" id="CRLastName" size="20">
Title:
<input name="CRTitle" type="text" id="CRTitle" size="30">
</font></p>
<p><font face="Times New Roman">Employer:
<input name="CREmployer" type="text" id="CREmployer" size="45">
</font></p>
<p><font face="Times New Roman">Street Address:
<input name="CRAddress" type="text" id="CRAddress" size="35">
</font><font face="Times New Roman"> City:
<input name="CRCity" type="text" id="CRCity" size="20" />
State:
<input name="CRState" type="text" id="CRState" size="10">
Zip:
<input name="CRZip" type="text" id="CRZip" size="9">
</font></p>
<p><font face="Times New Roman">Phone:
<input name="CRPhone" type="text" id="CRPhone" size="11">
</font><font face="Times New Roman"> Fax:
<input name="CRFax" type="text" id="CRFax" size="11">
Email:
<input name="CREmail" type="text" id="CREmail" size="30">
</font></p>
<p><font face="Times New Roman">Please send me information about the Vendor
Exhibition
<input name="CRVendor" type="checkbox" id="CRVendor" value="ON">
</font></p>
<table width="744" border="0">
<tr>
<td width="194"><span style="margin-top: 0"> <font face="Times New Roman">Are you an AWWA member?</font></span></td>
<td width="36"><font face="Times New Roman">Yes</font></td>
<td width="500"><font face="Times New Roman">
<input type="radio" value="Member" checked="checked" name="radmember" />
Member Number:
<input name="CRMemberNum" type="text" id="CRMemberNum" size="9" />
</font></td>
</tr>
<tr>
<td> </td>
<td><font face="Times New Roman">No</font></td>
<td><font face="Times New Roman">
<input type="radio" name="radmember" value="Not Member" />
</font></td>
</tr>
</table>
<p align="center"><b><font face="Times New Roman" size="5">Registration
Information</font></b></p>
<table cellpadding="0" cellspacing="0" width="82%">
<tr>
<td colspan="2"><pre class="style1"><input type="radio" name="RegType" value="FULL" onclick="javascript:Disabl
</b><i>Includes all conference technical sessions, Wednesday, Thursday, and Friday luncheons, Wednesday evening social, and Thursday <br />evening banquet</i><label></label>
</tr>
<tr>
<td><span class="style1">
<label>
<input name="CRRegular" type="checkbox" id="CRRegular" value="Regular" />
</label>
Regular </span></td>
<td>$180 <span class="style1">($230 after 9/13/2006) </span></td>
</tr>
<tr>
<td width="22%"><span class="style1"><i><i>
<label>
<input name="CRRetiree" type="checkbox" id="CRRetiree" value="Retiree" />
</label>
</i></i>Retiree </span></td>
<td width="78%">$55</td>
</tr>
<tr>
<td colspan="2"><div style="">
<pre><font face="Times New Roman">
<input type="radio" name="RegType" value="ONE_DAY" onclick="javascript:Disabl
<span class="style19"><font face="Times New Roman">Includes all conference technical sessions for that day and one </font></span><span class="style17"><font face="Times New Roman">luncheon</font></sp
</div></td>
</tr>
<tr>
<td colspan="2"><table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><font face="Times New Roman">
<input name="CROneDayWed" type="checkbox" id="CROneDayWed" value="One_Day Wednesday" />
Wednesday </font></td>
<td>$80 <span class="style1">($110 after 9/13/2006) </span></td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CROneDayThur" type="checkbox" id="CROneDayThur" value="One-Day Thursday" />
Thursday </font></td>
<td>$80 <span class="style1">($110 after 9/13/2006) </span></td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CROneDayFri" type="checkbox" id="CROneDayFri" value="One-Day Friday" />
Friday </font></td>
<td>$80 <span class="style1">($110 after 9/13/2006) </span></td>
</tr>
<tr>
<td colspan="2"><pre><font face="Times New Roman"><span class="style1">
<input type="radio" name="RegType" value="ONE_DAY" onclick="javascript:Disabl
<span class="style1"><em>Must be enrolled in an educational institution at least half time. Includes technical sessions and lunch for registered date(s). </em></span></pre> </td>
</tr>
<tr>
<td width="22%"><font face="Times New Roman">
<input name="CRStuWed" type="checkbox" id="CRStuWed" value="Student - Wednesday" />
Wednesday </font></td>
<td width="78%">$10</td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CRStuThur" type="checkbox" id="CRStuThur" value="Student Thursday" />
Thursday </font></td>
<td>$10</td>
</tr>
<tr>
<td><font face="Times New Roman">
<input name="CRStuFri" type="checkbox" id="CRStuFri" value="Student Friday" />
Friday </font></td>
<td>$10</td>
</tr>
</table>
<pre style="margin-bottom: 0"><span class="style1"><input name="CRGuest" type="checkbox" id="CRGuest" value="Guest Registraion:"><b>Guest/Spo
Includes conference activities, entrance to Vendor Exhibition, continental breakfasts, Wednesday Evening social, <br />and Thursday banquet</i></span></pre> </td>
</tr>
<tr>
<td><span class="style1"> Name:
<input name="GuestName" type="text" id="GuestName" value="" size="25" maxlength="40" />
</span></td>
<td class="style11">$55</td>
</tr>
<tr>
<td colspan="2"><pre class="style10"><font face="Times New Roman">
Additional Ticket(s) for Thursday Banquet</font></pre> </td>
</tr>
<tr>
<td>Quantity: <b><font face="Times New Roman">
<select name="CRTicket" id="CRTicket">
<option value="0" selected>0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</font></b></td>
<td class="style11">$30</td>
</tr>
<tr>
<td colspan="2"><pre class="style10"><label></l
</pre></td>
</tr>
</table></td>
</tr>
</table>
<p align="center"> <i> <font face="Bookman Old Style" size="2">  
<input type="reset" value="Reset" name="B2" />
&n
<input name="Submit" type="submit" onclick="CheckRegisration(
</a></font></i><br />
</p>
<p>
<input name="x_regular" type="hidden" id="x_regular" />
<input name="x_retiree" type="hidden" id="x_retiree" />
<input name="x_onewed" type="hidden" id="x_onewed" />
<input name="x_onethur" type="hidden" id="x_onethur" />
<input name="x_onefri" type="hidden" id="x_onefri" />
<input name="x_stuwed" type="hidden" id="x_stuwed" />
<input name="x_stuthur" type="hidden" id="x_stuthur" />
<input name="x_stufri" type="hidden" id="x_stufri" />
<input name="x_guest" type="hidden" id="x_guest" />
<input name="x_ticket" type="hidden" id="x_ticket" />
<input name="x_Amount" type="hidden" id="x_Amount" />
<input name="x_show" type="hidden" id="x_show" />
</p>
</form>
<script language="javascript">
<!--
Disabler();
//-->
</script>
</td>
</tr>
<!-- End code -->
<!-- located here for compatibility, fresh code/fixing code please direct to: -->
<span id="noprint_footer">
<!-- BEGIN: FOOTER -->
<!-- END: FOOTER -->
</span>
</td>
</body>
</html>
ASKER
Nope that didn't do it, and also it didn't insert a record into database at all.
You are loading the page, typing into the fields, and pressing the submit button right? I only ask because I created a test mdb and table and it worked on mine. Also the reason it put undefined into your db before was because it ran the code when the page loaded, and not when it should have, after you typed into the fields and pressed submit.
ASKER
Yup that's exactly what I did. You know, I created a test page with just two text boxes CRFirstName, and CRLastName, tested it and it worked. I'm thinking there's must be an error somewhere in my code. And I can't figure out what it is, maybe I'll just rebuild the whole page again. Gosh...that's goining to take alot of time. Thanks so much for your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hey compuken,
I just want to thank you for trying to help me all along.
I just want to thank you for trying to help me all along.
here s way:
Set Sessions = Server.CreateObject("ADODB
Sessions.ActiveConnection = [connectin string]
Sessions.CommandText = "insert into ConferenceRegistration (CRLastName, CRFirstName) values('CRLastName','CRFir
Sessions.execute
zeina