one word

C

cooldaddy

On my site I wanna generate a form based on a databse. Now when I try
to populate this form something strange happens. The string $namE
contains several words, seperated by spaces. However when I populate
the form, the script only prints out the first word. How come, and how
to solve this ?


#!/usr/bin/perl
use CGI;
my $q = new CGI;

$namE="test this form";
print $namE;

print qq{
<html>
<head>
<title>Untitled</title>
</head>

<form method="post" action="../cgi-bin/savetext.pl">
Name<br>
<input type=text name="name" value=$namE ><br>
Email<br>
<input type=text name="email" value=$emaiL ><br>
Text<br>
<textarea cols="60" rows="24" name="text" style="background-color:
#ffffff; color: #000000; font-size: 11pt;">
$texT
</textarea><br>
<input type=hidden name="part" value=$ARGV[0]$part>





<input type=submit value="send">
</form>

</html>
};
 
B

Brian Wakem

cooldaddy said:
On my site I wanna generate a form based on a databse. Now when I try
to populate this form something strange happens. The string $namE
contains several words, seperated by spaces. However when I populate
the form, the script only prints out the first word. How come, and how
to solve this ?
<input type=text name="name" value=$namE ><br>


Your error is an HTML one, not perl.
 
P

Paul Lalli

cooldaddy said:
On my site I wanna generate a form based on a databse. Now when I try
to populate this form something strange happens. The string $namE
contains several words, seperated by spaces. However when I populate
the form, the script only prints out the first word.

No it doesn't. The script prints exactly what you told it to print.
Your webbrowser, however, is not interpreting the results of the
script's output the way you think it is.
How come, and how to solve this ?


#!/usr/bin/perl
use CGI;
my $q = new CGI;

$namE="test this form";
print $namE;

print qq{
<html>
<head>
<title>Untitled</title>
</head>

<form method="post" action="../cgi-bin/savetext.pl">
Name<br>
<input type=text name="name" value=$namE ><br>

Have you viewed the source of the webpage that has this result? You
will see that $namE was correctly expanded. If you don't know why
you're getting the results you're seeing when the script's output is
viewed in a web browser, you need to contact a group that deals with
HTML.

Paul Lalli
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top