PDA

View Full Version : Capture email from a SPLIT function


jennypretty
03-17-2009, 03:45 PM
Hello,

I have been trying to capture the email using SPLIT function. It worked. But it did not hold the value. I have been trying for a few days but it still didn't work.

I can see the value for oRs("Email"), but it didn't hold on the next page. The value should be in Response.Write(Mail), it showed nothing.

Here is what I did:


<%
'page1.asp
Dim strFirst, str2First, strSir, str2Sir
strFirst = Request("FullNames")
str2First = split(strFirst,", ")
strSir = Request("FullNames")
str2Sir = split(strSir, ", ")
%>
<input type="hidden" name="FName" value="<%=str2First(1)%>">
<input type="hidden" name="LName" value="<%=str2Sir(0)%>">
<%
Set oRs=Server.CreateObject("adodb.recordset")
strSQL = "select Email from tbl_cars " _
& " where Firstname = '" & str2First(1) & "' " _
& " and Surname = '" & str2Sir(0) & "' "
oRs.Open strSQL, myConn
if not oRs.eof then %>
<input type="hidden" name="strEmail" value="<%=oRs("Email")%>
<% end if%>


'page2.asp
<% Dim Mail
Mail = Request.Form("strEmail")
Response.Write (Mail)
%>


Can you please help?
What did I do wrong and how to modify it to hold the value of Response.Write(Mail)?

Thank you very much.

Spudhead
03-17-2009, 04:03 PM
Is this online anywhere we can look at it?

Just to clarify - your first page has a hidden input on it called "strEmail", and when you view the source of that page in your browser, you can see that the hidden input has a value in it? And that first page submits a form - via POST - to a second page, which doesn't appear to be receiving the value that you can see from the first page?

jennypretty
03-17-2009, 04:32 PM
Yes. that's correct.

Even when i added Response.Write (strMail)

There is no value.

<input type="hidden" name="strEmail" value="<%=oRs("Email")%>"> has value, so why not Response.Write (strEmail)???

Thanks.

Spudhead
03-17-2009, 05:02 PM
I can't see a reason why that wouldn't work, so there must be another reason. Can you post the full source code for both pages?

jennypretty
03-17-2009, 08:05 PM
Here it is. I combined two pages into one.


<%
'page1.asp
Dim strFirst, str2First, strSir, str2Sir
strFirst = Request("FullNames")
str2First = split(strFirst,", ")
strSir = Request("FullNames")
str2Sir = split(strSir, ", ")
%>
<input type="hidden" name="FName" value="<%=str2First(1)%>">
<input type="hidden" name="LName" value="<%=str2Sir(0)%>">
<%
Set oRs=Server.CreateObject("adodb.recordset")
strSQL = "select Email from tbl_cars " _
& " where Firstname = '" & str2First(1) & "' " _
& " and Surname = '" & str2Sir(0) & "' "
oRs.Open strSQL, myConn
if not oRs.eof then %>
<input type="hidden" name="strEmail" value="<%=oRs("Email")%>">
<% end if%>

<% Dim Mail
Mail = Request.Form("strEmail")
Response.Write (Mail)
%>



thanks much.

Old Pedant
03-18-2009, 01:05 AM
That is *NOT* "full source."

Just for starters, you don't show your <FORM> tag.

And the code makes no sense at all when combined into a single page, because until you POST the <FORM>, there is NO VALUE in Request.Form.