Solved

HTML and ASP Forms - problems with spaces

Posted on 2004-04-01
5
183 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xml xsd validation free tool to download 10 76
PHP PDO get the error if exists 3 74
Facebook React and SyntheticEvents 6 49
.php tree directory? 5 56
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…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
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…

895 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now