navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Send form info to database AND select ID record

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Send form info to database AND select ID record
Page: [1]
 
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
Send form info to database AND select ID record - 2/15/2004 9:58:04   
I am trying to have my users verify who they are by saying OK to certain conditions BEFORE I let them view some confidential information (my client sells restaurants and we're trying to develop an online screening process). My problem is that I can't get the form to submit the information to a database AND bring the results page to the ID of the Record I want (that is one of the fields in the form) with only that record's details.

I get a blank record returned. I have tried several ways of using 'sessions', but have not come upon the right one yet. You can walk through the three steps by going to http://www.buysellarestaurant.com/reg/test3 (this page works fine). It will take you to http://www.buysellarestaurant.com/reg/test3/detail2.asp?ID=105 (depending on which record you select - this page also works fine). When you hit 'I AGREE' at the bottom, in the case, I want to pass ID 105 to the results page and have it return the private, confidential details of that record, but it gives a blank result at http://www.buysellarestaurant.com/reg/test3/detail344.asp (this is the page that doesn't work correctly).

Any thoughts? Thanks, Tim (tims@nettop.com)
BeTheBall

 

Posts: 6362
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Send form info to database AND select ID record - 2/15/2004 12:32:44   
Try this. The form on http://www.buysellarestaurant.com/reg/test3/detail2.asp should submit to:

http://www.buysellarestaurant.com/reg/test3/detail344.aspID=Request.Querystring("ID")

That should do it.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to nettop)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/15/2004 13:27:40   
The form is already submitting to a database as shown in <form method="POST" action="--WEBBOT-SELF--">

There are two other references to the page that I want to go to next:

Response.Redirect "detail344.asp"

and

<!--webbot bot="SaveDatabase" startspan SuggestedExt="asp" S-DataConnection="detail22" S-RecordSource="Results" U-Database-URL="../fpdb/detail2.mdb" U-Confirmation-Url="detail344.asp" S-Builtin-Fields="HTTP_USER_AGENT REMOTE_HOST Timestamp REMOTE_USER" S-Builtin-DBFields="Browser_type Remote_computer_name Timestamp User_name" S-Form-Fields="B2 UserName ID Date" S-Form-DBFields="B2 UserName ID1 Date" U-ASP-Include-Url="../_fpclass/fpdbform.inc" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="../_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" endspan i-checksum="34604" -->

The SUBMIT button has the following reference...is this where I edit?

<input border="0" src="../listings_prb/button32.jpg" type="submit" value="I AGREE" name="B1" type="image" alt="I AGREE" onmouseover="FP_swapImg(1,0,/*id*/'img2',/*url*/'../listings_prb/button33.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img2',/*url*/'../listings_prb/button32.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img2',/*url*/'../listings_prb/button34.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img2',/*url*/'../listings_prb/button33.jpg')" fp-style="fp-btn: Embossed Rectangle 8" fp-title="I AGREE">  

I'm not clear WHERE to edit? Thanks, Tim

< Message edited by nettop -- 2/15/2004 13:29:10 >

(in reply to BeTheBall)
BeTheBall

 

Posts: 6362
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Send form info to database AND select ID record - 2/15/2004 13:35:44   
Try here. Don't forget the "?". I missed it in my last post. I think when you change it in the gray code, the red will automatically update. If that doesn't work, post again and I will give you a more detailed way to change it.

<!--webbot bot="SaveDatabase" startspan SuggestedExt="asp" S-DataConnection="detail22" S-RecordSource="Results" U-Database-URL="../fpdb/detail2.mdb" U-Confirmation-Url="detail344.asp?ID=Request.Querystring("ID")" S-Builtin-Fields="HTTP_USER_AGENT REMOTE_HOST Timestamp REMOTE_USER" S-Builtin-DBFields="Browser_type Remote_computer_name Timestamp User_name" S-Form-Fields="B2 UserName ID Date" S-Form-DBFields="B2 UserName ID1 Date" U-ASP-Include-Url="../_fpclass/fpdbform.inc" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="../_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" endspan i-checksum="34604" -->

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to nettop)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/15/2004 13:57:39   
It didn't work.

It brought back the page with the following result and still no record:

http://www.buysellarestaurant.com/reg/test3/detail344.asp?ID=Request.Querystring(

I think we're getting close. Thanks, Tim

(in reply to BeTheBall)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/15/2004 14:34:56   
In reviewing the HTML code, in the RED, FP, do not EDIT area, it has the following:

Response.Redirect "detail344.asp?ID=Request.Querystring("

I can't get it to keep the whole thing.

detail344.asp?ID=Request.Querystring("ID")

Any thoughts? Thanks for all of your help...we're really close...I feel it, Tim

(in reply to nettop)
BeTheBall

 

Posts: 6362
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Send form info to database AND select ID record - 2/15/2004 14:52:12   
My fault. Try changing the URL to this:

U-Confirmation-Url="detail344.asp?ID="&Request.Querystring("ID")

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to nettop)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/15/2004 15:03:33   
I think we're almost there. Now it returns http://www.buysellarestaurant.com/reg/test3/detail344.asp?ID=

It appears that it is not picking up the ID# from the form at http://www.buysellarestaurant.com/reg/test3/detail2.asp?ID=104 (is a Database Results field).

I have tried setting the default ID=ID or ID= (in the database results wizard for the ID Field) and neither work. Any other suggestions? Maybe a different way of capturing the ID# that would be easier to pass it to the next page??

Thanks so much, Tim

(in reply to BeTheBall)
BeTheBall

 

Posts: 6362
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Send form info to database AND select ID record - 2/15/2004 21:14:41   
I am really not sure why it won't pick up the querystring. However, since you already have the ID number in the form. Change to: U-Confirmation-Url="detail344.asp?ID="&Request.Form("ID")

Anyone know why it won't read in the querystring? Spooky? rdouglass?

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to nettop)
Spooky

 

Posts: 26603
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Send form info to database AND select ID record - 2/15/2004 21:17:10   
What actually occurs on detail344.asp? You cant really modify the bot as above afaik.

You are querying a database to display user records?

If so, you need to use ID as the expected criteria at step 3 of the DRW

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to nettop)
BeTheBall

 

Posts: 6362
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Send form info to database AND select ID record - 2/15/2004 21:38:41   
quote:

You cant really modify the bot as above afaik.


I think Spooky is right. So, you need to modify the code a bit. First delete this line:

' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.

Then delete all the gray code between the <form> and </form> tags except this:

<!--#include file="_fpclass/fpdbform.inc"-->

Having done that, you can edit the redirect statement in red without having FP undo your changes. So you can change this code in red:

Response.Redirect "detail344.asp"

to

Response.Redirect "detail344.asp?ID="&Request.Form("ID")

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to Spooky)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/16/2004 10:53:17   
THANK SO MUCH FOR WORKING THROUGH THIS WITH ME...IT WORKS GREAT!!! THIS FORUM IS SO AWESOME!!! Tim :)

(in reply to BeTheBall)
BeTheBall

 

Posts: 6362
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Send form info to database AND select ID record - 2/16/2004 10:56:44   
Phew! That one looked easier than it was! Glad you got what you need. Glad to have you as a member of our little community.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to nettop)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/21/2004 12:56:06   
Well, of course, my client wants another field to the database that we are sending the data to, and I have added the field ("_1_description_and_price") to this form, but it won't submit to the Database. The form is located at http://www.buysellarestaurant.com/reg/listings_prb/detail2_spooky.asp?ID=110 . Any ideas on how to get the "_1_description_and_price" field to submit correctly to the database would be most appreciated.

Thanks, Tim

(in reply to BeTheBall)
BeTheBall

 

Posts: 6362
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Send form info to database AND select ID record - 2/21/2004 14:07:16   
You will have to hand modify the red code. Please post the red portion of the code for detail2_spooky.asp

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to nettop)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/21/2004 14:09:32   
Here you go:

<form method="POST" action="--WEBBOT-SELF--">
<font face="Arial">
<input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"></font><font face="Arial">

<!--#include file="../_fpclass/fpdbform.inc"-->

</font>

<p class="MsoBodyText"><font face="Arial">User Name: <select size="1" name="UserName">
<option selected value="<% =Session("UserName") %>"><% =Session("UserName") %>
</option>
</select></font></p>
<p class="MsoBodyText"><font face="Arial">Business ID #:  </font> <nobr>
<font face="Arial">
<!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results WHERE (ID = ::ID::)"
fp_sDefault="ID="
fp_sNoRecords="No records returned."
fp_sDataConn="listings"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="ID"
fp_sMenuValue="ID"
fp_sColTypes="&ID=3&_1_description_and_price=202&Business_name=202&Street_Address=202&City=202&State=202&Zip=202&Type=202&_2_Area=202&Detailed_Description=203&Ownership_Structure=202&_4_Employees=202&_5_Year_Established=202&_6_Seats=202&_7_Parking=202&_8_Licenses_Required=202&_9_Hrs_Open=202&_10_Sq_Ft_Size=202&_11_Lease_Term=202&_12_Lease_Options=202&_13_Base_Rent=202&_14_Last_Years_Annual_Gross=202&_15_Annual_Adjusted_Net_Profit=202&_16_COGS=202&_17_Inventory=202&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&Misc_1=202&Misc_2=202&Misc_3=202&Misc_4=202&"
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=1
fp_iRegion=BOTID
%>
<select NAME="ID" SIZE="1">
<!--#include file="../_fpclass/fpdbrgn1.inc"-->

<option><%=FP_FieldHTML(fp_rs,"ID")%></option>
<!--#include file="../_fpclass/fpdbrgn2.inc"-->
</select></font></nobr></p>
<p class="MsoBodyText"><font face="Arial">Short Description:  <nobr>
<!--#include file="../_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM Results WHERE (ID = ::ID::)"
fp_sDefault="ID="
fp_sNoRecords="No records returned."
fp_sDataConn="listings"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="_1_description_and_price"
fp_sMenuValue="_1_description_and_price"
fp_sColTypes="&ID=3&_1_description_and_price=202&Business_name=202&Street_Address=202&City=202&State=202&Zip=202&Type=202&_2_Area=202&Detailed_Description=203&Ownership_Structure=202&_4_Employees=202&_5_Year_Established=202&_6_Seats=202&_7_Parking=202&_8_Licenses_Required=202&_9_Hrs_Open=202&_10_Sq_Ft_Size=202&_11_Lease_Term=202&_12_Lease_Options=202&_13_Base_Rent=202&_14_Last_Years_Annual_Gross=202&_15_Annual_Adjusted_Net_Profit=202&_16_COGS=202&_17_Inventory=202&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&Misc_1=202&Misc_2=202&Misc_3=202&Misc_4=202&Operation_Desc_1=202&MiscO9=202&MiscO10=202&Payroll_detailF4=202&Misc1F8=202&Misc2F9=202&Misc3F10=202&Misc_31=203&photo1_sm=202&photo1_lg=202&photo2_sm=202&photo2_lg=202&photo3_sm=202&photo3_lg=202&photo4_sm=202&photo4_lg=202&photo5_sm=202&photo5_lg=202&photo6_sm=202&photo6_lg=202&"
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<select NAME="_1_description_and_price" SIZE="1">
<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<option><%=FP_FieldHTML(fp_rs,"_1_description_and_price")%></option>
<!--#include file="../_fpclass/fpdbrgn2.inc"-->
</select></nobr></font></p>
<p class="MsoBodyText">
<font face="Arial">
<input border="0" src="button32.jpg" type="submit" value="I AGREE" name="B1" type="image" alt="I AGREE" onmouseover="FP_swapImg(1,0,/*id*/'img2',/*url*/'button33.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img2',/*url*/'button32.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img2',/*url*/'button34.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img2',/*url*/'button33.jpg')" fp-style="fp-btn: Embossed Rectangle 8" fp-title="I AGREE">  
<a href="default.asp">
<img border="0" id="img1" src="button2F.jpg" height="20" width="100" alt="I DISAGREE" onmouseover="FP_swapImg(1,0,/*id*/'img1',/*url*/'button30.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img1',/*url*/'button2F.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img1',/*url*/'button31.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img1',/*url*/'button30.jpg')" fp-style="fp-btn: Embossed Rectangle 8; fp-font-size: 12" fp-title="I DISAGREE"></a></font></p>
</form>

(in reply to BeTheBall)
BeTheBall

 

Posts: 6362
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Send form info to database AND select ID record - 2/21/2004 14:16:48   
Oops. Not the part I need. If you refresh the page FP should display several lines in red at the very top of the page. That is where the modifications need to be made.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to nettop)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/21/2004 14:56:49   
Sorry about that...here you go:

<%
On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Session.LCID = 1033
Err.Clear

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear

Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"

Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"

fp_conn.Open Application("detail22_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open "Results", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(4)
Dim arFormDBFields0(4)
Dim arFormValues0(4)

arFormFields0(0) = "B2"
arFormDBFields0(0) = "B2"
arFormValues0(0) = Request("B2")
arFormFields0(1) = "UserName"
arFormDBFields0(1) = "UserName"
arFormValues0(1) = Request("UserName")
arFormFields0(2) = "ID"
arFormDBFields0(2) = "ID1"
arFormValues0(2) = Request("ID")
arFormFields0(3) = "Date"
arFormDBFields0(3) = "Date"
arFormValues0(3) = Request("Date")

FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0

If Request.ServerVariables("HTTP_USER_AGENT") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("HTTP_USER_AGENT"), "Browser_type"
End If
If Request.ServerVariables("REMOTE_HOST") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_HOST"), "Remote_computer_name"
End If
FP_SaveFieldToDB fp_rs, Now, "Timestamp"
If Request.ServerVariables("REMOTE_USER") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_USER"), "User_name"
End If

fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"

fp_rs.Close
fp_conn.Close

Session("FP_SavedFields")=arFormFields0
Session("FP_SavedValues")=arFormValues0
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
Response.Redirect "detail344.asp?ID="&Request.Form("ID")

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>

(in reply to BeTheBall)
BeTheBall

 

Posts: 6362
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Send form info to database AND select ID record - 2/21/2004 15:06:11   
Modify this:

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(4)
Dim arFormDBFields0(4)
Dim arFormValues0(4)

arFormFields0(0) = "B2"
arFormDBFields0(0) = "B2"
arFormValues0(0) = Request("B2")
arFormFields0(1) = "UserName"
arFormDBFields0(1) = "UserName"
arFormValues0(1) = Request("UserName")
arFormFields0(2) = "ID"
arFormDBFields0(2) = "ID1"
arFormValues0(2) = Request("ID")
arFormFields0(3) = "Date"
arFormDBFields0(3) = "Date"
arFormValues0(3) = Request("Date")

To this:

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(5)
Dim arFormDBFields0(5)
Dim arFormValues0(5)

arFormFields0(0) = "B2"
arFormDBFields0(0) = "B2"
arFormValues0(0) = Request("B2")
arFormFields0(1) = "UserName"
arFormDBFields0(1) = "UserName"
arFormValues0(1) = Request("UserName")
arFormFields0(2) = "ID"
arFormDBFields0(2) = "ID1"
arFormValues0(2) = Request("ID")
arFormFields0(3) = "Date"
arFormDBFields0(3) = "Date"
arFormValues0(3) = Request("Date")
arFormFields0(4) = ","_1_description_and_price"
arFormDBFields0(4) = "_1_description_and_price"
arFormValues0(4) = Request(","_1_description_and_price")

Just a side note. I see you have a db field named "Date". Date is a reserved word for SQL, so if you need to do an update or call the field in a SELECT statement, you will need to surround it with brackets, like this:

[Date]

In future products, you would be wise to use something like "MyDate".

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to nettop)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/21/2004 16:40:11   
There were a few extra ',"' in what you sent me with the "_1_description_and_price" field

but after getting rid of the extra ," it works GREAT!!! Thanks, Tim

(in reply to BeTheBall)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/21/2004 16:44:55   
Is there a way to retrieve the record information and input it into a database so that it doesn't show as a drop down selection in the way I've done it at the bottom of http://www.buysellarestaurant.com/reg/listings_prb/detail2_spooky.asp?ID=110 ?

Thanks, Tim

(in reply to nettop)
BeTheBall

 

Posts: 6362
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Send form info to database AND select ID record - 2/21/2004 17:42:10   
quote:

There were a few extra ',"' in what you sent me with the "_1_description_and_price" field


Cursed cut -n- paste!

quote:

Is there a way to retrieve the record information and input it into a database so that it doesn't show as a drop down selection


You know, looking at your code you may want to redo the form. For one, you are making two calls to the same database table to get the ID and the description. You already have the ID, so why go to the db again for that?

I would go with something like this:

<form method="POST" action="--WEBBOT-SELF--"> 
<font face="Arial"> 
<input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"> 

<!--#include file="../_fpclass/fpdbform.inc"--> 

</font> 

<p class="MsoBodyText"><font face="Arial">User Name: <input type="text" name="UserName" size="10" value="<%=Session("UserName")%>"> 
</font></p> 
<font face="Arial"> 
<!--#include file="../_fpclass/fpdblib.inc"--> 
<% if 0 then %> 
<SCRIPT Language="JavaScript"> 
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>"); 
</SCRIPT> 
<% end if %> 
<% 
fp_sQry="SELECT * FROM Results WHERE (ID = ::ID::)" 
fp_sDefault="ID=" 
fp_sNoRecords="No records returned." 
fp_sDataConn="listings" 
fp_iMaxRecords=256 
fp_iCommandType=1 
fp_iPageSize=0 
fp_fTableFormat=False 
fp_fMenuFormat=True 
fp_sMenuChoice="ID" 
fp_sMenuValue="ID" 
fp_sColTypes="&ID=3&_1_description_and_price=202&Business_name=202&Street_Address=202&City=202&State=202&Zip=202&Type=202&_2_Area=202&Detailed_Description=203&Ownership_Structure=202&_4_Employees=202&_5_Year_Established=202&_6_Seats=202&_7_Parking=202&_8_Licenses_Required=202&_9_Hrs_Open=202&_10_Sq_Ft_Size=202&_11_Lease_Term=202&_12_Lease_Options=202&_13_Base_Rent=202&_14_Last_Years_Annual_Gross=202&_15_Annual_Adjusted_Net_Profit=202&_16_COGS=202&_17_Inventory=202&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&Misc_1=202&Misc_2=202&Misc_3=202&Misc_4=202&" 
fp_iDisplayCols=1 
fp_fCustomQuery=False 
BOTID=1 
fp_iRegion=BOTID 
%> 
<!--#include file="../_fpclass/fpdbrgn1.inc"--> 
<p>Business ID #: <input type="text" name="ID" size="10" value="<%=FP_FieldHTML(fp_rs,"ID")%>"></p>
<p>Short Description: <input type="text" name="_1_description_and_price" value="<%=FP_FieldHTML(fp_rs,"_1_description_and_price")%>"></p>
<!--#include file="../_fpclass/fpdbrgn2.inc"-->
</form>


That will display the values in text boxes as opposed to select boxes.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to nettop)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/21/2004 19:14:08   
But I don't want people to be able to EDIT them. Is there a way to 'grey' them out so they are uneditable, but viewable?

Thanks, Tim

(in reply to BeTheBall)
BeTheBall

 

Posts: 6362
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Send form info to database AND select ID record - 2/21/2004 21:41:25   
In that case, use a DRW to display the results, then within the DRW region insert a form and include your fields as hidden fields. That way the data displays simply as text entries instead of form fields. So, within the yellow rows in your DRW region, insert the form. Then right-click the form and choose "Form Properties". Click the "Advanced" tab to add your hidden fields. The fields should have the same names and values as your current form, just be "Hidden" instead of "text".

Does that help???

< Message edited by betheball -- 2/21/2004 19:42:21 >


_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to nettop)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/22/2004 0:20:39   
Makes sense...I just haven't used 'hidden' fields yet, but I'll give it a try. Thanks, Tim

(in reply to BeTheBall)
struan

 

Posts: 1
Joined: 2/23/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/27/2004 8:13:20   
I have been stuggling with an almost identical challenge, and was delighted to discover your dialogue on how to send to a database and the next page.... I have tried following the instructions posted, but evertime I delete the grey sections of code from my page, it stops working completley. Wont load.

All I can think is that I am deleting the wrong bits of grey code.

on my page the following bits of grey code appear between the form tags.




<!--webbot bot="SaveDatabase" suggestedext="asp" u-asp-include-url="../_fpclass/fpdbform.inc" s-dataconnection="evaluations" s-recordsource="Answers" u-database-url="../fpdb/evaluations.mdb" u-confirmation-url="first_question.asp?NextQuestionNo=" s-builtin-fields="REMOTE_HOST Timestamp REMOTE_USER" s-builtin-dbfields="computername Date Username" s-form-fields="QuestionNo Important Questionaire NextQuestionNo True Question" s-form-dbfields="QuestionNo ImportantScore Questionaire ltdpn TrueScore Question" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="../_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" endspan i-checksum="34604" --><!--webbot bot="DatabaseRegionStart" s-columnnames="QuestionID,Questionaire,QuestionNo,Question,NextQuestionNo" s-columntypes="3,202,3,202,3" s-dataconnection="evaluations" b-tableformat="FALSE" b-menuformat="FALSE" s-menuchoice s-menuvalue b-tableborder="TRUE" b-tableexpand="TRUE" b-tableheader="TRUE" b-listlabels="FALSE" b-listseparator="FALSE" i-listformat="7" b-makeform="TRUE" s-recordsource="Questions_with_next_no" s-displaycolumns="Questionaire,QuestionNo,Question,NextQuestionNo" s-criteria="[Questionaire] EQ {Questionaire} + {QuestionNo} EQ {NextQuestionNo} +" s-order s-sql="SELECT * FROM Questions_with_next_no WHERE (Questionaire = '::Questionaire::' AND QuestionNo = ::NextQuestionNo::)" b-procedure="FALSE" clientside suggestedext="asp" s-defaultfields="Questionaire=&NextQuestionNo=" s-norecordsfound="Thankyou. That was the last question" i-maxrecords="0" i-groupsize="0" botid="0" u-dblib="../_fpclass/fpdblib.inc" u-dbrgn1="../_fpclass/fpdbrgn1.inc" u-dbrgn2="../_fpclass/fpdbrgn2.inc" tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00" align="left"><font color="#000000">This is the start of a Database Results region.</font></td></tr></table>" startspan --><!--#include file="../_fpclass/fpdblib.inc"-->



<!--#include file="../_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan i-checksum="22123" -->


<!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="FALSE" u-dbrgn2="../_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00" align="left"><font color="#000000">This is the end of a Database Results region.</font></td></tr></table>" startspan --><!--#include file="../_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan i-checksum="56926" -->





Note, I want the redirect to go to first_question.asp?NextQuestionNo=X where "X" is the value from the form



My wife is desperaste to get be back..... if you can solve this for me, we woukld both be most gratefull!



:-)

Struan

(in reply to BeTheBall)
nettop

 

Posts: 212
Joined: 2/9/2004
Status: offline

 
RE: Send form info to database AND select ID record - 2/27/2004 9:27:08   
Make sure when you delete the 'grey' code, that you DON'T delete any text in red, that is inside the grey code (field info) (scrool all the way out to the right to see what I mean on the LONG text grey code) AND make sure to NOT delete info that starts with <!--#include file

This is the 'Spooky' way of doing it.

(in reply to struan)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Send form info to database AND select ID record
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts