Newbie Form Question

B

Bill

I have a form for a guestbook. I want to Append something what is entered
into the comments by adding "Location: " in bold to the beginnning of the
entry for when it is sent to the cgi script (which I can't access)

<tr>
<td><strong><font size="-1" face="Arial, Helvetica, sans-serif"
align="left">Location:</font></strong></td>
<td><font size="-1" face="Arial, Helvetica, sans-serif" align="left">
<input name="2.Location" type="text" size="41">
</font></td>
</tr>

For example, when it says hte following when signing the guestbook"
Location: (form to enter one's location)
But only the form info (ie. location) that is entered are being sent and
thus only the actual entry is sent
I want it so "Location:" then the entry from the form are being sent....

For example, if someone entered New York
Location: <<form to enter one's lcoation - New York in this case>>
only "New York" is sent
I want "Location: New York" to be sent. I to add the word "Location: " to
the front as well

Any help is much appreciated...

Bill
 
C

Chris Leonard

I have a form for a guestbook. I want to Append something what is entered
into the comments by adding "Location: " in bold to the beginnning of the
entry for when it is sent to the cgi script (which I can't access)
<input name="2.Location" type="text" size="41">

Bill. Basically you can't do it.

You need to be able to access the CGI script which is the best way to do
this. There are two dirty way round your problem I can think of.

1. <input name="2.Location" type="text" size="41" value="Location:">

This adds the string location to the input box, problem is it can be
removed, so, not much good

2. You could use the OnSubmit JavaScript function to add the word location
to the beginning of the text. I've not tried this and I'm unsure if it will
work but it's worth a try.

Here's some code you can play with ....

<script language="JavaScript">
function validate() {
x=document.guestbook.location.value
document.guestbook.location.value="Location:"+x
}
</SCRIPT>
</head>
<body>
<form name="guestbook" method="POST" action="script.cgi" onSubmit="return
validate();">

Hope this helps you.

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,207
Latest member
HelenaCani

Latest Threads

Top