Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-13-2003, 12:20 AM   PM User | #1
Speedy
Regular Coder

 
Join Date: May 2003
Location: Stockholm, Sweden
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Speedy is an unknown quantity at this point
No values saved in my db, why?

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
Code:
<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
Code:
<%@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
Speedy is offline   Reply With Quote
Old 12-13-2003, 04:15 AM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
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
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Old 12-13-2003, 10:24 AM   PM User | #3
Speedy
Regular Coder

 
Join Date: May 2003
Location: Stockholm, Sweden
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Speedy is an unknown quantity at this point
What made it not work was this stupid part of the form tag:

ENCTYPE="text/plain"

When I took this away it worked.

/Speedy
Speedy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:45 AM.


Advertisement
Log in to turn off these ads.