Solved

HTML and ASP Forms - problems with spaces

Posted on 2004-04-01
5
188 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

623 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