Solved

HTML and ASP Forms - problems with spaces

Posted on 2004-04-01
5
184 Views
Last Modified: 2010-04-06
Hi,

I am putting together a set of pages that collect data from a form (page 1), confirm the data (page 2) and give confirmation of submission (page 3).

I am having trouble if there is a space between the data entered (eg. "Not Issued" only gets saved as "Not"). It works fine if I don't confirm the data ie. submit it straight to the database. Where is my code going wrong?

Example of code on page 1:

<TABLE bgColor=white border=0 cellPadding=2 cellSpacing=1 width="400" height="70">
  <TR>
    <TD width="500" height="20"><font face="Arial Narrow">Location:</font></TD>
    <TD><font face="Arial"><input type = "text" input name="location" size="30"></TD>
  </TR>
</TABLE>

Page 2:
<HEAD>
      LOCATION = request.form("location")
</HEAD>
<BODY>
  <tr>
    <td width="50%" style="border-style: none; border-width: medium">
    <font face="Arial Narrow">Location:</font></td>
    <td width="50%" style="border-style: none; border-width: medium"><font face="Arial Narrow"><%=location%></font><input type="hidden" name=location value=<%=location%>>&nbsp;</td>
  </tr>

This works fine even if the location has more than one word

Page 3:
<HEAD>      
<%
LOCATION = request.form("LOCATION")
SQL = "INSERT INTO TABLENAME (Location) VALUES ('"&location&"')"
DbObj.Execute(SQL)
%>
</HEAD>
<BODY>
<font face="Arial Narrow">The parking space location <%=location%><input type="hidden" name=location value=<%=location%>>&nbsp;</td> has been added.</font></p>
</BODY>

This part does not work properly if there is more than one word. Only the first word shows up on this page.

Can anyone help please?
0
Comment
Question by:Shellyness
  • 2
  • 2
5 Comments
 
LVL 30

Accepted Solution

by:
third earned 50 total points
ID: 10737282
this is common mistake for not using "" in values. just modify this on your 2nd page

<input type="hidden" name="location" value="<%=location%>">&nbsp;</td>

do it also on your third page,

<font face="Arial Narrow">The parking space location <%=location%><input type="hidden" name=location value="<%=location%>">&nbsp;</td> has been added.</font></p>

make it a habit. put quotation marks between the values of tag attributes.
0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10737285

in pages 2 and 3

Include quotes around the value...

<input type="hidden" name=location value="<%=location%>">
0
 
LVL 1

Author Comment

by:Shellyness
ID: 10737452
Thanks heaps guys! I'm very new to this and I have generally no idea!

Sorry venkateshwarr, third pipped you to the post on this one!

0
 
LVL 30

Expert Comment

by:third
ID: 10737459

;-)
0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10739572
That ok...
:-)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Simple PHP - search by location postcode/zip code 8 33
RSS Feed Validation 2 63
CSS Question.. 3 85
Randomize in Owl Carousel v1.3.2 6 44
When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question