newlines and query -> param / problem with apostrophes 
Author Message
 newlines and query -> param / problem with apostrophes

Hi

I have a perl script which obtains values from a textarea on the web.
Although I have the textarea set to "WRAP=physical", when try to get the
content of my texarea i.e.

$query = new CGI;
$Description = $query->param("description");

The text comes out as one long string, without newlines.

Is there a way of using $query->param so I can preserve newlines?

My second question may be a bit off topic as it partly refers to SQL (I
hope people don't mind, but it also relates to perl).

If, in my text I have something like:

"The users' data" , i.e. I have a apostrophe after users, the data are
not accepted into the SQL database, I think because the ' ends the input
string abruptly during the INSERT statement. Is there a way in perl to
neutralise such characters, so they will not create problems when an
INSERT statement is made to SQL?

Any help will be greatly appreciated.

Thanks

Hugo

--
Dr Hugo Bouckaert
Systems and Programming Engineer

Fractal GeoInformatics
57 Havelock St
West Perth, WA 6005
PO Box 1675, West Perth 6872

Ph:       61 08 9211 6000
Fax:      61 08 9226 1299

www.fractalgraphics.com.au

------------------------------------------------------------------------
This email and any attachments may be confidential or legally
privileged. If you received this message in error or are not the
intended recipient, you should destroy the e-mail message and any
attachments or copies, and you are prohibited from retaining,
distributing, disclosing or using any information contained herein.
Please inform us of the erroneous delivery by return e-mail. Thank you
for your cooperation.



Tue, 11 Jan 2005 05:41:56 GMT  
 newlines and query -> param / problem with apostrophes


Quote:
> Hi

<SNIP>

Quote:
> If, in my text I have something like:

> "The users' data" , i.e. I have a apostrophe after users, the data are
> not accepted into the SQL database, I think because the ' ends the input
> string abruptly during the INSERT statement. Is there a way in perl to
> neutralise such characters, so they will not create problems when an
> INSERT statement is made to SQL?

If you are using the DBI perl module then read up on the quote() method.

<SNIP>



Tue, 11 Jan 2005 09:39:36 GMT  
 newlines and query -> param / problem with apostrophes

Quote:

> Subject: Re: newlines and query -> param / problem with apostrophes

If you have two independant questions to ask then please post them separately.

Subject: newlines and query -> param in CGI
Subject: problem with apostrophes in SQL

Quote:
> I have a perl script which obtains values from a textarea on the web.
> Although I have the textarea set to "WRAP=physical", when try to get the
> content of my texarea i.e.

> $query = new CGI;
> $Description = $query->param("description");

> The text comes out as one long string, without newlines.

> Is there a way of using $query->param so I can preserve newlines?

The Perl CGI module does not mangle the data.  As such this is a
question about HTML and/or web browsers.  It has nothing to do with
Perl.

Quote:
> My second question may be a bit off topic

Like your first one, you mean.

Quote:
> as it partly refers to SQL

So why did 'SQL' not appear in the subject line?

Quote:
> "The users' data" , i.e. I have a apostrophe after users, the data are
> not accepted into the SQL database, I think because the ' ends the input
> string abruptly during the INSERT statement. Is there a way in perl to
> neutralise such characters, so they will not create problems when an
> INSERT statement is made to SQL?

Assuming you are using the DBI module, use placeholders or the quote()
method.  If you are using some other module then check the
documentation of that module for analagous mechanisms.

Quote:
> This email and any attachments may be confidential or legally
> privileged. If you received this message in error or are not the
> intended recipient, you should destroy the e-mail message and any
> attachments or copies, and you are prohibited from retaining,
> distributing, disclosing or using any information contained herein.

I suggest you do not include this drivel in your Usenet postings - it
makes you look rather silly.

--
     \\   ( )
  .  _\\__[oo

 .  l___\\
  # ll  l\\
 ###LL  LL\\



Tue, 11 Jan 2005 08:39:00 GMT  
 newlines and query -> param / problem with apostrophes

Quote:


>> This email and any attachments may be confidential or legally
>> privileged. If you received this message in error or are not the
>> intended recipient, you should destroy the e-mail message and any
>> attachments or copies, and you are prohibited from retaining,
>> distributing, disclosing or using any information contained herein.
> I suggest you do not include this drivel in your Usenet postings - it
> makes you look rather silly.

In a lot of cases, that sort of nonsense is added automatically by an
internal intranet/Internet gateway and there's no way for an ordinary user
to avoid it.  Or it may be required by company policy (though I suspect a
good lawyer could argue that repeatedly using that kind of boilerplate in
places where it's obviously meaningless could cause it to lose legal force
in the kinds of situations where it really is necessary).


Tue, 11 Jan 2005 10:30:14 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. $query->param problem using cgi.pm

2. Parsing $query->param(s)

3. $query->param not working.

4. Cannot evaluate $query->param('thing')

5. $query->param('textarea');

6. Printing $query->param in a here-doc?

7. problem with $query->redirect and Netscape

8. problem with $query->redirect and Netscape

9. CGI.pm and $query->self_url problems

10. problem with setting default selection in $query->scrolling_list using CGI.pm

11. $query->header problem with cgi module

12. file opened with "+>>" query

 

 
Powered by phpBB® Forum Software