www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 20

Thread: VB Script - form going post.asp not working

  1. #1
    Join Date
    Jan 2004
    Location
    Switzerland
    Posts
    154

    VB Script - form going post.asp not working

    I have a form on one of my pages, and the form posts to post.asp.

    This is the code from the post.asp file:
    <%@ Language=VBScript %>
    <%
    sub main
    dim objMail
    dim sMsg
    dim sItem
    sMsg = ""
    For Each sItem In Request.Form
    sMsg = sMsg & sItem & ": " & Request.Form(sItem) & "<br>"
    Next

    Set objMail = Server.CreateObject("CDONTS.NewMail")
    objMail.From = "list@troytrumm.com"
    objMail.To = "list@troytrumm.com"
    objMail.Subject = Request.ServerVariables("HTTP_REFERER")
    objMail.Body = sMsg
    objMail.BodyFormat=0
    objMail.Send
    Set objMail = Nothing

    Response.Redirect("thanks.html")

    end sub

    call main
    %>


    Upon submitting the form, the page is supposed to redirect to thanks.html, but it doesn't. Instead, the frame where the form is just goes blank. If anyone can help me, I would greatly appreciate it. Thank you!

  2. #2
    Join Date
    Oct 2006
    Posts
    1,297
    ...and if you re-arrange it this way -- what happens?
    Code:
    <%@ Language=VBScript %>
    <%
    dim objMail, sMsg, sItem
    sMsg = ""
    For Each sItem In Request.Form
    sMsg = sMsg & sItem & ": " & Request.Form(sItem) & "<br>"
    Next
    
    Set objMail = Server.CreateObject("CDONTS.NewMail")
    objMail.From = "list@troytrumm.com"
    objMail.To = "list@troytrumm.com"
    objMail.Subject = Request.ServerVariables("HTTP_REFERER")
    objMail.Body = sMsg
    objMail.BodyFormat=0 
    objMail.Send
    Set objMail = Nothing
    
    Response.Clear
    Response.Redirect("thanks.html")
    Response.End
    %>

  3. #3
    Join Date
    Feb 2003
    Posts
    2,745
    code looks fine. other than a couple of minor things that arent the problem. lets see the form code too

  4. #4
    Join Date
    Nov 2006
    Posts
    104
    I agree with russle. Please post you form code.

  5. #5
    Join Date
    Jan 2004
    Location
    Switzerland
    Posts
    154
    Quote Originally Posted by so_is_this
    ...and if you re-arrange it this way -- what happens?
    Code:
    <%@ Language=VBScript %>
    <%
    dim objMail, sMsg, sItem
    sMsg = ""
    For Each sItem In Request.Form
    sMsg = sMsg & sItem & ": " & Request.Form(sItem) & "<br>"
    Next
    
    Set objMail = Server.CreateObject("CDONTS.NewMail")
    objMail.From = "list@troytrumm.com"
    objMail.To = "list@troytrumm.com"
    objMail.Subject = Request.ServerVariables("HTTP_REFERER")
    objMail.Body = sMsg
    objMail.BodyFormat=0 
    objMail.Send
    Set objMail = Nothing
    
    Response.Clear
    Response.Redirect("thanks.html")
    Response.End
    %>
    If I arrange it that way, I receive this error:

    Code:
    Error Type:
    Response object, ASP 0159 (0x80004005)
    Buffering must be on.
    /post_copy.asp, line 18

  6. #6
    Join Date
    Jan 2004
    Location
    Switzerland
    Posts
    154
    Here is the form code:

    Code:
    <FORM METHOD="post" ACTION="post.asp">
    		<input type="hidden" name="redirect" value="thanks.html">
    			<TABLE cellSpacing="0" cellPadding="12" width="100%" border="0">
    				<TBODY>
    					<TR>
    						<TD class="btcontent" vAlign="top">&nbsp;
    							<TABLE cellSpacing="0" cellPadding="0" border="0">
    								<TR>
    									<TD vAlign="top">
    										<H1>
    											Request a&nbsp;Market Analysis</H1>
    										<P>Want to know how much your home is worth at present market conditions?&nbsp;
    											Fill out the form below for a free market analysis.&nbsp; </P>
    										<TABLE cellSpacing="4" cellPadding="0" width="100%" border="0">
    											<TR>
    												<TD>Name:</TD>
    												<TD><INPUT size="30" name="FirstName"></TD>
    											</TR>
    											<TR>
    												<TD>E-mail:</TD>
    												<TD><INPUT size="30" name="EmailAddress">
    												</TD>
    											</TR>
    											<TR>
    												<TD>Daytime Phone:</TD>
    												<TD><INPUT maxLength="15" size="10" name="Phone"></TD>
    											</TR>
    											<TR>
    												<TD>Evening Phone:</TD>
    												<TD><INPUT maxLength="15" size="10" name="Phone2"></TD>
    											</TR>
    											<TR>
    												<TD colSpan="2">
    													<HR width="90%" SIZE="1">
    												</TD>
    											</TR>
    											<TR>
    												<TD class="Content1" colSpan="2">
    													<P>Property Information:</P>
    												</TD>
    											</TR>
    											<TR>
    												<TD class="Content1">Address:</TD>
    												<TD><INPUT size="30" name="StreetName"></TD>
    											</TR>
    											<TR>
    												<TD class="Content1">City:</TD>
    												<TD><INPUT size="30" name="City"></TD>
    											</TR>
    											<TR>
    												<TD class="Content1">State:</TD>
    												<TD><SELECT id="state" name="state"><OPTION selected></OPTION>
    														<OPTION value="AL">Alabama</OPTION>
    														<OPTION value="AK">Alaska</OPTION>
    														<OPTION value="AB">Alberta</OPTION>
    														<OPTION value="AZ">Arizona</OPTION>
    														<OPTION value="AR">Arkansas</OPTION>
    														<OPTION value="BC">British Columbia</OPTION>
    														<OPTION value="CA">California</OPTION>
    														<OPTION value="CO">Colorado</OPTION>
    														<OPTION value="CT">Connecticut</OPTION>
    														<OPTION value="DE">Delaware</OPTION>
    														<OPTION value="DC">District Of Columbia</OPTION>
    														<OPTION value="FL">Florida</OPTION>
    														<OPTION value="GA">Georgia</OPTION>
    														<OPTION value="HI">Hawaii</OPTION>
    														<OPTION value="ID">Idaho</OPTION>
    														<OPTION value="IL">Illinois</OPTION>
    														<OPTION value="IN">Indiana</OPTION>
    														<OPTION value="IA">Iowa</OPTION>
    														<OPTION value="KS">Kansas</OPTION>
    														<OPTION value="KY">Kentucky</OPTION>
    														<OPTION value="LA">Louisiana</OPTION>
    														<OPTION value="ME">Maine</OPTION>
    														<OPTION value="MB">Manitoba</OPTION>
    														<OPTION value="MD">Maryland</OPTION>
    														<OPTION value="MA">Massachusetts</OPTION>
    														<OPTION value="MI">Michigan</OPTION>
    														<OPTION value="MN">Minnesota</OPTION>
    														<OPTION value="MS">Mississippi</OPTION>
    														<OPTION value="MO">Missouri</OPTION>
    														<OPTION value="MT">Montana</OPTION>
    														<OPTION value="NE">Nebraska</OPTION>
    														<OPTION value="NV">Nevada</OPTION>
    														<OPTION value="NB">New Brunswick</OPTION>
    														<OPTION value="NH">New Hampshire</OPTION>
    														<OPTION value="NJ">New Jersey</OPTION>
    														<OPTION value="NM">New Mexico</OPTION>
    														<OPTION value="NY">New York</OPTION>
    														<OPTION value="NC">North Carolina</OPTION>
    														<OPTION value="ND">North Dakota</OPTION>
    														<OPTION value="OH">Ohio</OPTION>
    														<OPTION value="OK">Oklahoma</OPTION>
    														<OPTION value="ON">Ontario</OPTION>
    														<OPTION value="OR">Oregon</OPTION>
    														<OPTION value="PA">Pennsylvania</OPTION>
    														<OPTION value="PR">Puerto Rico</OPTION>
    														<OPTION value="RI">Rhode Island</OPTION>
    														<OPTION value="SK">Saskatchewan</OPTION>
    														<OPTION value="SC">South Carolina</OPTION>
    														<OPTION value="SD">South Dakota</OPTION>
    														<OPTION value="TN">Tennessee</OPTION>
    														<OPTION value="TX">Texas</OPTION>
    														<OPTION value="UT">Utah</OPTION>
    														<OPTION value="VT">Vermont</OPTION>
    														<OPTION value="VI">Virgin Islands</OPTION>
    														<OPTION value="VA">Virginia</OPTION>
    														<OPTION value="WA">Washington</OPTION>
    														<OPTION value="DC">Washington DC</OPTION>
    														<OPTION value="WV">West Virginia</OPTION>
    														<OPTION value="WI">Wisconsin</OPTION>
    														<OPTION value="WY">Wyoming</OPTION>
    													</SELECT></TD>
    											</TR>
    											<TR>
    												<TD class="Content1">ZIP Code:
    												</TD>
    												<TD><INPUT maxLength="10" size="10" name="Zip"></TD>
    											</TR>
    											<TR>
    												<TD class="Content1">
    													Style of Home:
    												</TD>
    												<TD><SELECT name="StyleOfHomeId">
    														<OPTION>Ranch</OPTION>
    														<OPTION>Raised Ranch</OPTION>
    														<OPTION>Split Entry</OPTION>
    														<OPTION>Bungalow</OPTION>
    														<OPTION>Tri-Level</OPTION>
    														<OPTION>Multi-Level</OPTION>
    														<OPTION>1.5 Story</OPTION>
    														<OPTION>2 Story</OPTION>
    														<OPTION>2.5 Story</OPTION>
    														<OPTION>Mobile Home</OPTION>
    														<OPTION>Earth Sheltered</OPTION>
    														<OPTION>Apartment</OPTION>
    														<OPTION>Hi-Rise</OPTION>
    														<OPTION>Dome</OPTION>
    														<OPTION>A-Frame</OPTION>
    														<OPTION>Other</OPTION>
    
    													</SELECT></TD>
    											</TR>
    											<TR>
    												<TD class="Content1">Number of Bedrooms:
    												</TD>
    												<TD><SELECT name="Bedrooms"><OPTION value="1" selected>1</OPTION>
    														<OPTION value="2">2</OPTION>
    														<OPTION value="3">3</OPTION>
    														<OPTION value="4">4</OPTION>
    														<OPTION value="5">5</OPTION>
    													</SELECT></TD>
    											</TR>
    											<TR>
    												<TD class="Content1">Number of Bathrooms:</TD>
    												<TD><SELECT name="Baths"><OPTION value="1" selected>1</OPTION>
    														<OPTION value="2">2</OPTION>
    														<OPTION value="3">3</OPTION>
    														<OPTION value="4">4</OPTION>
    														<OPTION value="5">5</OPTION>
    													</SELECT></TD>
    											</TR>
    											<TR>
    												<TD class="Content1">Finished Square Footage:
    												</TD>
    												<TD><INPUT maxLength="10" size="10" name="SquareFootage"></TD>
    											</TR>
    											<TR>
    												<TD class="Content1">Year Built:</TD>
    												<TD><INPUT maxLength="10" size="10" name="YearBuilt"></TD>
    											</TR>
    											<TR>
    												<TD class="Content1" vAlign="top">Amenities:</TD>
    												<TD class="Content1">
    													<P><TEXTAREA name="OtherAmenities" rows="4" wrap="physical" cols="23"></TEXTAREA>&nbsp;</P>
    													<P>&nbsp;</P>
    												</TD>
    											</TR>
    											<TR>
    												<TD class="Content1" vAlign="top">When are you planning to sell:</TD>
    												<TD class="Content1">
    													<P><SELECT name="TimeToSell">
    															<OPTION selected>Now</OPTION>
    															<OPTION>3 Months</OPTION>
    															<OPTION>
    																6 Months</OPTION>
    															<OPTION>9 Months</OPTION>
    															<OPTION>
    																12 Months</OPTION>
    															<OPTION>
    																over 1 year</OPTION>
    														</SELECT>
    													</P>
    													<P>&nbsp;</P>
    												</TD>
    											</TR>
    											<TR>
    												<TD colSpan="2">
    													<P>
    													<P></P>
    													<P align="center"><BR>
    														I am eager to hear your concerns and expectations about the marketing of your
    														property. Please enter any questions or comments you have below.
    													</P>
    													<P align="center"><TEXTAREA id="txtareaconcerns" name="Concerns" rows="4" wrap="physical" cols="45"></TEXTAREA>
    														<BR>
    													</P>
    												</TD>
    											</TR>
    											<TR vAlign="top">
    												<TD align="middle" colSpan="2"><INPUT type="hidden" value="webmaster@stephanierief.com" name="emailfrom">
    													<INPUT type="hidden" value="list@troytrumm.com" name="emailto"> <INPUT type="hidden" value="Request CMA" name="mailsubject">
    													<INPUT type="hidden" value="thanks.html" name="maildirect">&nbsp;
    													<BR>
    													<INPUT type="submit" value="Submit" name="Submit"></TD>
    											</TR>
    										</TABLE>
    									</TD>
    									<TD vAlign="top" align="right"><BR>
    									</TD>
    								</TR>
    								<TR> <!-- TD starts bottom nav -->
    									<TD align="middle" colSpan="4">
    										<P>&nbsp;</P>
    									</TD>
    								</TR>
    							</TABLE>
    							<P><A href="home.html">Back to Home</A></P>
    							<P>
    								<TABLE cellSpacing="3" cellPadding="3" width="100%" border="0" id="Table1">
    									<TR>
    										<TD class="btfoot" vAlign="top"> 2007 Alliance Real Estate&nbsp;-&nbsp;Troy Trumm
    											licensed in Nebraska. All rights reserved.
    										</TD>
    									</TR>
    								</TABLE>
    							</P>
    						</TD>
    					</TR>
    				</TBODY></TABLE>
    		</FORM>
    Thanks for your help.

  7. #7
    Join Date
    Oct 2006
    Posts
    1,297
    Quote Originally Posted by mickapoo
    If I arrange it that way, I receive this error:
    Code:
    Error Type:
    Response object, ASP 0159 (0x80004005)
    Buffering must be on.
    /post_copy.asp, line 18
    hehehe... That answers one question -- but it leaves open the possibility of the other still unanswered question. You see... A redirect request cannot be honored if normal HTTP headers have already been sent to the client. What causes these headers to be sent is if HTTP output (normally of HTML for the client) begins to take place. Even a blank line of output can cause this.

    Barring directly addressing the arrangement of the document output to prevent that occurrence, then the use of outbound buffering is the second best solution. Outbound buffering prevents sending *any* output to the client until either your code signals that it is time to send such -- or -- the end of your document processing is reached.

  8. #8
    Join Date
    Feb 2003
    Posts
    2,745
    Quote Originally Posted by so_is_this
    hehehe... That answers one question -- but it leaves open the possibility of the other still unanswered question. You see... A redirect request cannot be honored if normal HTTP headers have already been sent to the client. What causes these headers to be sent is if HTTP output (normally of HTML for the client) begins to take place. Even a blank line of output can cause this.

    Barring directly addressing the arrangement of the document output to prevent that occurrence, then the use of outbound buffering is the second best solution. Outbound buffering prevents sending *any* output to the client until either your code signals that it is time to send such -- or -- the end of your document processing is reached.
    but http headers have not yet been sent in original code

  9. #9
    Join Date
    Feb 2003
    Posts
    2,745
    i take it back. went to actual web site and tried it. lots wrong there. mickapoo, so_is_this is correct. you need to do all that processing, and especially the redirect b4 flushing any content to the stream. that means b4 any response.writes and any raw html. you have thios problem on several links actuallly.

    if u dont understand this, post the entire code for post.asp and we'll help ya straighten it out.

    good catch so_is_this

  10. #10
    Join Date
    Jan 2004
    Location
    Switzerland
    Posts
    154
    Quote Originally Posted by russell
    if u dont understand this, post the entire code for post.asp and we'll help ya straighten it out.

    good catch so_is_this
    I tried the suggestion above (the suggestion by so_is_this) but I got the error message (I pasted above).

    Here is the code from post.asp:

    Code:
    <%@ Language=VBScript %>
    <%
    sub main
    dim objMail
    dim sMsg
    dim sItem
    sMsg = ""
    For Each sItem In Request.Form
    sMsg = sMsg & sItem & ": " & Request.Form(sItem) & "<br>"
    Next
    
    Set objMail = Server.CreateObject("CDONTS.NewMail")
    objMail.From = "list@troytrumm.com"
    objMail.To = "list@troytrumm.com"
    objMail.Subject = Request.ServerVariables("HTTP_REFERER")
    objMail.Body = sMsg
    objMail.BodyFormat=0 
    objMail.Send
    Set objMail = Nothing
    
    Response.Redirect("thanks.html")
    
    end sub
    
    call main
    %>
    Thanks for your help!

  11. #11
    Join Date
    Feb 2003
    Posts
    2,745
    thats the entire code? i went to web site and it appears to be a lot more. i dont think u should re-arrange your code like so_is_this says, but i do think he found the source your error.

    try this: submit the form, then right-click the blank frame. view source. what do u see in the source? especially look for http errors. but if you see incomplete html, then u have a server-side error. also, make sure any On Error Resume Next is commented out while debugging.

  12. #12
    Join Date
    Jan 2004
    Location
    Switzerland
    Posts
    154
    Quote Originally Posted by russell
    thats the entire code? i went to web site and it appears to be a lot more.
    Yes, that is the entire code from the form.asp file. I just double checked, that is all that is there.

    Quote Originally Posted by russell
    try this: submit the form, then right-click the blank frame. view source. what do u see in the source?

    Here is the code:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD><TITLE>Troy Trumm - Real Estate Information focusing on Omaha Nebraska</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <META content="Real Estate" name=description>
    <META 
    content="Omaha, real estate, agent, real estate agent, MLS, selling, home, house, property, buy, sell, realtor, OABR, full service, Troy Trumm, Trumm, Alliance, Alliance Real Estate, discount brokerage, FSBO, for sale by owner, listing" 
    name=keywords>
    <META 
    content="2007 All rights reserved.  Duplication of any content on this site is prohibited." 
    name=copyright>
    <META content=all,index,follow name=robots>
    <META content="14 days" name=revisit-after>
    <META content=global name=distribution>
    <META content=general name=document-classification>
    <META content=general name=rating>
    <META content=EN name=language><LINK href="btstyle408.css" type=text/css 
    rel=stylesheet></HEAD>
    <BODY leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
    <TABLE id=Table1 height="100%" cellSpacing=0 cellPadding=0 width="100%" 
    bgColor=#ffffff border=0>
    <TBODY>
    <TR>
    <TD width="50%" bgColor=#7f0400 rowSpan=3>&nbsp;</TD>
    <TD width=1 bgColor=#000000 rowSpan=3><IMG height=1 src="images/spacer.gif" 
    width=1></TD>
    <TD>
    <TABLE cellSpacing=0 cellPadding=0 width=750 bgColor=#7f0400 border=0>
    <TBODY>
    <TR>
    <TD vAlign=top colSpan=2 height=14>
    <P align=right><A href="index.html"><IMG alt="" src="images/topimage.gif" 
    align=bottom border=0>&nbsp;<BR><IMG alt="" src="images/alliance white.gif" 
    align=left border=0></A> <B><A 
    href="http://www.forsalebyalliance.com/agents.php?agent_id=38" 
    target=cright>&nbsp; <FONT color=white size=3>See my 
    listings</FONT></A>&nbsp;&nbsp;</B>&nbsp;<BR><FONT color=#ffffff 
    size=6><STRONG>(402) 943-9494</STRONG></FONT></P></TD></TR>
    <TR>
    <TD colSpan=2><FONT color=white><B></B><B>Buy or Sell your home... Serving 
    Omaha, Nebraska and Surrounding areas of Millard, Papillion, La Vista, Ralston, 
    Bellevue, and Offutt.</B></FONT> </TD></TR>
    <TR>
    <TD class=bknav vAlign=top width=200>
    <P><IMG alt="Troy Trumm" src="images/troytrumm.gif"> <IMG alt="Troy Trumm" 
    src="images/me_small.jpg" width=72 align=right border=0> <BR><FONT 
    size=1>Licensed in Nebraska<BR><BR>Alliance Real Estate<BR></FONT><FONT 
    size=1>12165 W Center Rd<BR>Suite 83<BR>Omaha, NE 68144<BR></FONT>(402) 
    943-9494<BR><BR><B><A 
    href="http://www.alliancesells.com/listings.php?search_action=execute&amp;search_acode=0&amp;cx_on=no&amp;search_subdiv=x&amp;search_zip=0&amp;search_style=0&amp;search_beds=0&amp;search_baths=0&amp;search_garages=0&amp;search_sqft=0&amp;search_price_low=0&amp;search_price_high=0&amp;search_agent=38" 
    target=new>See my listings</A><BR><A 
    href="http://oabrmls.rapmls.com/scripts/mgrqispi.dll?APPNAME=Omaha&amp;PRGNAME=MLSLogin&amp;ARGUMENT=14IaNt4X2h5vt0ZTwQiaVg%3D%3D" 
    target=new>Search all MLS listings</A> </B><BR><BR><A 
    href="mailto:troy@troytrumm.com">Troy@TroyTrumm.com</A><BR><A href="home.html" 
    target=mainframe>Return to Home Page </A></P>
    <P><IMG alt="Home Sellers" src="images/sell.gif"><BR><A href="sell.html" 
    target=mainframe>Listing Services</A><BR><A href="list.html" 
    target=mainframe>List your home</A> <BR><A href="cma.html" 
    target=mainframe>Request a Market Analysis</A><BR><BR></P>
    <P><IMG alt="Home Buyers" src="images/buy.gif"><BR><A href="buy.html" 
    target=mainframe>Buy a home </A><BR><A href="calc.html" 
    target=mainframe>Calculate Monthly Payment="home.html" width=550 
    height=1250></IFRAME></TD></TR></TBODY></TABLE></TD>
    <TD width=1 bgColor=#000000 rowSpan=3><IMG height=1 src="images/spacer.gif" 
    width=1></TD>
    <TD width="50%" bgColor=#7f0400 
    rowSpan=3>&nbsp;</TD></TR></TBODY></TABLE></BODY></HTML>

  13. #13
    Join Date
    Feb 2003
    Posts
    2,745
    need to see the entire post.asp, not form.asp

    also, in the code u posted, there is no opening iframe tag, but there is a closing one. still there is more going on in post.asp that we need to see...

  14. #14
    Join Date
    Jan 2004
    Location
    Switzerland
    Posts
    154
    Quote Originally Posted by russell
    need to see the entire post.asp, not form.asp
    My mistake, I referred to it as form.asp, it was actually post.asp. Here is the code, all of it, from the post.asp file:
    Code:
    <%@ Language=VBScript %>
    <%
    sub main
    	dim objMail
    	dim sMsg
    	dim sItem
    	sMsg = ""
    	For Each sItem In Request.Form
    		sMsg = sMsg & sItem & ": " & Request.Form(sItem) & "<br>"
    	Next
    	
    	Set objMail = Server.CreateObject("CDONTS.NewMail")
    	objMail.From = "list@troytrumm.com"
    	objMail.To = "list@troytrumm.com"
    	objMail.Subject = Request.ServerVariables("HTTP_REFERER")
    	objMail.Body = sMsg
    	objMail.BodyFormat=0	
    	objMail.Send
    	Set objMail = Nothing
    	
    	Response.Redirect("thanks.html")
    
    end sub
    
    call main
    %>
    Thank you again.

  15. #15
    Join Date
    Feb 2003
    Posts
    2,745
    ahhh, u are running asp on apache huh? interesting. ok, anyway, there is a lot of content coming from somewhere and it isnt from the code u show above.

    is this the page in question?
    http://www.troytrumm.com/list.html
    http://www.troytrumm.com/post.asp

    any include files in post.asp?
    anything in config writing headers and footers to all pages?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles