...

View Full Version : No values saved in my db, why?



Speedy
12-13-2003, 01:20 AM
Hi,

I wonder what I've missed in my code cuz when I submit my form
I don't get any error message but when I check my db there is
no values saved in it. The only thing tha happens in the db
is that the primary key counts up by 1.

test.mdb (access)
stats (ID[Primary Key, Counter], Bana1, Bana2, Bana3, Bana4,
Bana5, Bana6, Bana7, Bana8, Bana9, Bana10, Bana11, Bana12,
Bana13, Bana14, Bana15, Bana16, Bana17, Bana18)


Here's my code:

ResultInput.asp


<form method="post" action="add.asp?competition=<%=Request.QueryString("competition")%>" name="scorecard" ENCTYPE="text/plain"
onsubmit="return focusEmpty(this)">
<div id="box">
<table>
<tr>
<td><b>1</b></td>
<td><b>2</b></td>
<td><b>3</b></td>
<td><b>4</b></td>
<td><b>5</b></td>
<td><b>6</b></td>
<td><b>7</b></td>
<td><b>8</b></td>
<td><b>9</b></td>
</tr>
<tr>
<td><input type="text" name="bana1" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana2" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana3" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana4" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana5" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana6" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana7" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana8" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana9" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
</tr>
<tr>
<td colspan="9" height="10">
</td>
</tr>
<tr>
<td><b>10</b></td>
<td><b>11</b></td>
<td><b>12</b></td>
<td><b>13</b></td>
<td><b>14</b></td>
<td><b>15</b></td>
<td><b>16</b></td>
<td><b>17</b></td>
<td><b>18</b></td>
</tr>
<tr>
<td><input type="text" name="bana10" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana11" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana12" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana13" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana14" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana15" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana16" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana17" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
<td><input type="text" name="bana18" size="1" maxLength="1" onKeyUp="return checkInput(this)" onBlur="return checkNum(this)"></td>
</tr>
<tr>
<td colspan="9" height="20"></td>
</tr>
<tr>
<td colspan="3" align="left"><b>Summa:</b>
<input id="summa" name="summa<%=Request.QueryString("varv")%>" type="text" value="0" size="2" readOnly="readonly">
</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2" align="center">
<input type="submit" value="Regga" name="submit_button">
</td>
<td colspan="2" align="center">
<input type="reset" value="Sudda" name="reset_button" onClick="return(confirm('År du säker på att du vill tömma alla fält?')&&bana1.focus())">
</td>
</tr>
</table>
</div>
</form>


Add.asp


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<!-- #include file="db/adovbs.inc" -->
<%

Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("db\test.mdb")

Set RecSet = Server.CreateObject("ADODB.Recordset")
Addera = "SELECT * FROM stats"

RecSet.Open Addera, Connect, adOpenStatic, adLockOptimistic

RecSet.AddNew

RecSet("Bana1") = Request.Form("bana1")
RecSet("Bana2") = Request.Form("bana2")
RecSet("Bana3") = Request.Form("bana3")
RecSet("Bana4") = Request.Form("bana4")
RecSet("Bana5") = Request.Form("bana5")
RecSet("Bana6") = Request.Form("bana6")
RecSet("Bana7") = Request.Form("bana7")
RecSet("Bana8") = Request.Form("bana8")
RecSet("Bana9") = Request.Form("bana9")
RecSet("Bana10") = Request.Form("bana10")
RecSet("Bana11") = Request.Form("bana11")
RecSet("Bana12") = Request.Form("bana12")
RecSet("Bana13") = Request.Form("bana13")
RecSet("Bana14") = Request.Form("bana14")
RecSet("Bana15") = Request.Form("bana15")
RecSet("Bana16") = Request.Form("bana16")
RecSet("Bana17") = Request.Form("bana17")
RecSet("Bana18") = Request.Form("bana18")

RecSet.Update
RecSet.Close
Connect.Close
%>

<center>Inputs are now saved!<br><a href="ResultInput.asp">Back</a></center>
</body>
</html>


/Speedy

A1ien51
12-13-2003, 05:15 AM
before I even think about your code...are you sure that the values are being posted to the next page.

Response.Write those babies out and see if they are not null.

Eric

Speedy
12-13-2003, 11:24 AM
What made it not work was this stupid part of the form tag:

ENCTYPE="text/plain"

When I took this away it worked.

/Speedy



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum