Here is the code:
<SELECT NAME="email" style="font-family: Verdana; font-size: 10pt; "
size="1">
<%
DO WHILE NOT objRS.EOF
strEmail = objRS("email")
strLName = objRS("last_name")
strFName = objRS("first_name")
%>
<option value="<% =strEmail %>"><%= strLName & ", " & strFName %>
</option>
<%
objRS.MoveNext
Loop

objRS.Close
Set objRS = Nothing

%>

</SELECT></font></b></td>
<input type="hidden" name="last_name" value="<% =strLName %>">

snip

<INPUT TYPE=SUBMIT VALUE="Submit Form">


Now when the form is submitted to my results page that updates the database,
the value for strLName is, obvioulsy, the last record in the database. How
do I make the value equal what the user selected from the drop down?

Or in other words, if my drop down value is:
1
2
3
4
5,
and the user picks 3, the value that gets added to the db is always 5...

TIA

Re: Hidden field with variable problem by Ray

Ray
Mon Sep 15 13:21:28 CDT 2003

Easiest way that wouldn't rely on client side coding would be to do:


<option value="<%=strEmail & "," & strLName%>"><%= strLName & ", " &
strFName %></option>


Then on the page that processes this data, the value of
request.form("email") would be something like:

joe@domain.com,Bergey

So, you can then do

aEmailInfo = Split(REquest.Form("email"), ",")
sEmail = aEmailInfo(0)
sLName = aEmailInfo(1)


Basically, you have to pass the last name in a form field. But let me ask
you this. If the info is coming from the database, why do you need to do
this? Isn't this person's information already in the database? Like, it
seems that if I were in your database, I could tell you my e-mail address,
and you could then in turn tell me my last name, so why do you need to
update this column like this?

Ray at work







"Tom Petersen" <petert@sdsd.sdbor.edu> wrote in message
news:O5gL2S7eDHA.392@TK2MSFTNGP12.phx.gbl...
> Here is the code:
> <SELECT NAME="email" style="font-family: Verdana; font-size: 10pt; "
> size="1">
> <%
> DO WHILE NOT objRS.EOF
> strEmail = objRS("email")
> strLName = objRS("last_name")
> strFName = objRS("first_name")
> %>
> <option value="<% =strEmail %>"><%= strLName & ", " & strFName %>
> </option>
> <%
> objRS.MoveNext
> Loop
>
> objRS.Close
> Set objRS = Nothing
>
> %>
>
> </SELECT></font></b></td>
> <input type="hidden" name="last_name" value="<% =strLName %>">
>
> snip
>
> <INPUT TYPE=SUBMIT VALUE="Submit Form">
>
>
> Now when the form is submitted to my results page that updates the
database,
> the value for strLName is, obvioulsy, the last record in the database.
How
> do I make the value equal what the user selected from the drop down?
>
> Or in other words, if my drop down value is:
> 1
> 2
> 3
> 4
> 5,
> and the user picks 3, the value that gets added to the db is always 5...
>
> TIA
>
>



Re: Hidden field with variable problem by Tom

Tom
Mon Sep 15 13:23:32 CDT 2003

The value of your select is not the strLName it's the strEmail.
Why do you want to use a hidden field?
You shouldn't use strEmail as a unique value, my wife and I share an email
account?

I'll assume that you know what you're doing and the above is my error.
What you'll need to do is either a)re-query the database based on the
selected email or b) parse out the last name from the content of the
<select> on the client, and update your hidden form.
To do "b" would require some client side scripting such as javascript.


"Tom Petersen" <petert@sdsd.sdbor.edu> wrote in message
news:O5gL2S7eDHA.392@TK2MSFTNGP12.phx.gbl...
> Here is the code:
> <SELECT NAME="email" style="font-family: Verdana; font-size: 10pt; "
> size="1">
> <%
> DO WHILE NOT objRS.EOF
> strEmail = objRS("email")
> strLName = objRS("last_name")
> strFName = objRS("first_name")
> %>
> <option value="<% =strEmail %>"><%= strLName & ", " & strFName %>
> </option>
> <%
> objRS.MoveNext
> Loop
>
> objRS.Close
> Set objRS = Nothing
>
> %>
>
> </SELECT></font></b></td>
> <input type="hidden" name="last_name" value="<% =strLName %>">
>
> snip
>
> <INPUT TYPE=SUBMIT VALUE="Submit Form">
>
>
> Now when the form is submitted to my results page that updates the
database,
> the value for strLName is, obvioulsy, the last record in the database.
How
> do I make the value equal what the user selected from the drop down?
>
> Or in other words, if my drop down value is:
> 1
> 2
> 3
> 4
> 5,
> and the user picks 3, the value that gets added to the db is always 5...
>
> TIA
>
>



Re: Hidden field with variable problem by Tom

Tom
Mon Sep 15 13:36:55 CDT 2003

I think I am confusing myself!
I have two databases, one already contains email, last_name and first_name.
My problem is updating the second database with all of the same fields when
my form is only 'collecting' the email. So can I still use your method if I
also need the first name, how does the Split work if I 'need' a second
comma?

Or should I use Tom B's suggestion and grab the info I need from database
base 1 using a query like Select last_name, first_name from xxx Where email
= request.form(email), using the correct syntax of course... Whic do you
think would be better?

Thanks!



"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:u1livY7eDHA.2348@TK2MSFTNGP12.phx.gbl...
> Easiest way that wouldn't rely on client side coding would be to do:
>
>
> <option value="<%=strEmail & "," & strLName%>"><%= strLName & ", " &
> strFName %></option>
>
>
> Then on the page that processes this data, the value of
> request.form("email") would be something like:
>
> joe@domain.com,Bergey
>
> So, you can then do
>
> aEmailInfo = Split(REquest.Form("email"), ",")
> sEmail = aEmailInfo(0)
> sLName = aEmailInfo(1)
>
>
> Basically, you have to pass the last name in a form field. But let me ask
> you this. If the info is coming from the database, why do you need to do
> this? Isn't this person's information already in the database? Like, it
> seems that if I were in your database, I could tell you my e-mail address,
> and you could then in turn tell me my last name, so why do you need to
> update this column like this?
>
> Ray at work
>
>
>
>
>
>
>
> "Tom Petersen" <petert@sdsd.sdbor.edu> wrote in message
> news:O5gL2S7eDHA.392@TK2MSFTNGP12.phx.gbl...
> > Here is the code:
> > <SELECT NAME="email" style="font-family: Verdana; font-size: 10pt; "
> > size="1">
> > <%
> > DO WHILE NOT objRS.EOF
> > strEmail = objRS("email")
> > strLName = objRS("last_name")
> > strFName = objRS("first_name")
> > %>
> > <option value="<% =strEmail %>"><%= strLName & ", " & strFName %>
> > </option>
> > <%
> > objRS.MoveNext
> > Loop
> >
> > objRS.Close
> > Set objRS = Nothing
> >
> > %>
> >
> > </SELECT></font></b></td>
> > <input type="hidden" name="last_name" value="<% =strLName %>">
> >
> > snip
> >
> > <INPUT TYPE=SUBMIT VALUE="Submit Form">
> >
> >
> > Now when the form is submitted to my results page that updates the
> database,
> > the value for strLName is, obvioulsy, the last record in the database.
> How
> > do I make the value equal what the user selected from the drop down?
> >
> > Or in other words, if my drop down value is:
> > 1
> > 2
> > 3
> > 4
> > 5,
> > and the user picks 3, the value that gets added to the db is always 5...
> >
> > TIA
> >
> >
>
>



Re: Hidden field with variable problem by Ray

Ray
Mon Sep 15 13:51:50 CDT 2003


"Tom Petersen" <petert@sdsd.sdbor.edu> wrote in message
news:%23fGemk7eDHA.632@TK2MSFTNGP10.phx.gbl...
> I think I am confusing myself!
> I have two databases,

Eegs!

> one already contains email, last_name and first_name.
> My problem is updating the second database with all of the same fields
when
> my form is only 'collecting' the email. So can I still use your method if
I
> also need the first name, how does the Split work if I 'need' a second
> comma?

You can have as many commas as you like, or you can use any character.
Split() will create an array by splitting the string on whatever
character(s) you specify. For example:

TheString="ray@mydomain.com|Costanzo|Ray"
TheSplitStringArray = Split(TheString, "|")

You'll then have an array with three elements:
TheSplitStringArray(0) = "ray@mydomain.com"
TheSplitStringArray(1) = "Costanzo"
TheSplitStringArray(2) = "Ray"





>
> Or should I use Tom B's suggestion and grab the info I need from database
> base 1 using a query like Select last_name, first_name from xxx Where
email
> = request.form(email), using the correct syntax of course... Whic do you
> think would be better?
>

I would use Tom's suggestion of NOT using e-mail addresses as your unique
identifier. Let's assume your data in database1 looks like this:

ID Email LName Fname

What you should do then is use the ID number in your SELECT, and when the
person selects the value and submits the form, query the e-mail address,
last name, and firstname from database1 and do what you have to do with it
in database2 then.

Ray at work




Re: Hidden field with variable problem by Tom

Tom
Mon Sep 15 14:16:40 CDT 2003

Ray,
That did it, thanks!

Tom B, thanks for chiming in as well, I went the parse route, and learned
about the Split 'command'



Re: Hidden field with variable problem by Dan

Dan
Mon Sep 15 14:29:02 CDT 2003

On Mon, 15 Sep 2003 14:21:28 -0400, "Ray at <%=sLocation%>"
<myfirstname at lane34 dot com> wrote:

>Easiest way that wouldn't rely on client side coding would be to do:
>
>
> <option value="<%=strEmail & "," & strLName%>"><%= strLName & ", " &
>strFName %></option>
>
>
>Then on the page that processes this data, the value of
>request.form("email") would be something like:
>
>joe@domain.com,Bergey
>
>So, you can then do
>
>aEmailInfo = Split(REquest.Form("email"), ",")
>sEmail = aEmailInfo(0)
>sLName = aEmailInfo(1)
>
>
>Basically, you have to pass the last name in a form field. But let me ask
>you this. If the info is coming from the database, why do you need to do
>this? Isn't this person's information already in the database? Like, it
>seems that if I were in your database, I could tell you my e-mail address,
>and you could then in turn tell me my last name, so why do you need to
>update this column like this?
>
>Ray at work
>
>
Or, of course (assuming you have a unique ID for your records) just
use the ID as the value and look up what you need using a query on
that ID field.

Re: Hidden field with variable problem by Ray

Ray
Mon Sep 15 14:31:14 CDT 2003

Quote from another reply: What you should do then is use the ID number in
your SELECT
:P

Ray at work

"Dan Brussee" <dbrussee@NOSPAMnc.rr.com> wrote in message
news:jm4cmvcolsvcuno8blbt88sgrn084e0lfo@4ax.com...

> >
> Or, of course (assuming you have a unique ID for your records) just
> use the ID as the value and look up what you need using a query on
> that ID field.



Re: Hidden field with variable problem by Tom

Tom
Mon Sep 15 14:25:03 CDT 2003

Dan, good call, didn't even think of that, but I did get what I needed
working, so I'm not going to touch it! :)


"Dan Brussee" <dbrussee@NOSPAMnc.rr.com> wrote in message
news:jm4cmvcolsvcuno8blbt88sgrn084e0lfo@4ax.com...
> On Mon, 15 Sep 2003 14:21:28 -0400, "Ray at <%=sLocation%>"
> <myfirstname at lane34 dot com> wrote:
>
> >Easiest way that wouldn't rely on client side coding would be to do:
> >
> >
> > <option value="<%=strEmail & "," & strLName%>"><%= strLName & ", " &
> >strFName %></option>
> >
> >
> >Then on the page that processes this data, the value of
> >request.form("email") would be something like:
> >
> >joe@domain.com,Bergey
> >
> >So, you can then do
> >
> >aEmailInfo = Split(REquest.Form("email"), ",")
> >sEmail = aEmailInfo(0)
> >sLName = aEmailInfo(1)
> >
> >
> >Basically, you have to pass the last name in a form field. But let me
ask
> >you this. If the info is coming from the database, why do you need to do
> >this? Isn't this person's information already in the database? Like, it
> >seems that if I were in your database, I could tell you my e-mail
address,
> >and you could then in turn tell me my last name, so why do you need to
> >update this column like this?
> >
> >Ray at work
> >
> >
> Or, of course (assuming you have a unique ID for your records) just
> use the ID as the value and look up what you need using a query on
> that ID field.