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
> >
> >
>
>