Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

HTML and ASP Forms - problems with spaces

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
Shellyness
Asked:
Shellyness
  • 2
  • 2
1 Solution
 
thirdCommented:
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
 
venkateshwarrCommented:

in pages 2 and 3

Include quotes around the value...

<input type="hidden" name=location value="<%=location%>">
0
 
ShellynessAuthor Commented:
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
 
thirdCommented:

;-)
0
 
venkateshwarrCommented:
That ok...
:-)
0

Featured Post

Industry Leaders: 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!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now