[FX.php List] Text encoding problem

Bob Patin bob at patin.com
Sun Oct 15 13:32:22 MDT 2006


Oh! I realize now that nl2br mean "new line to line break..."

I'll give it a try; thanks,

Bob




On Oct 15, 2006, at 2:23 PM, Erik Andreas Cayré wrote:

>
> Den 15/10/2006 kl. 17.05 skrev Bob Patin:
>
>> It's a fairly simple form; here's the code for editing the record:
>>
>> <?php
>> include_once('FX/server_data.php');
>> include_once('FX/FX.php');
>>
>> $title = $_POST['title'];
>> $teaser = $_POST['teaser'];
>> $newsitem = nl2br(stripslashes($_POST['newsitem']));
>
> This is the culprit.
> nl2br: You are converting newlines to <br> before storing into the  
> db (which is what you don't want... right?)
>
> Instead you may want the opposite...
> Doing this conversion, when showing the contents of the db as HTML.  
> (but not inside a TEXTAREA)...
>
>> $id = $_POST['id'];
>>
>> $itin=new FX($serverIP,$webCompanionPort);
>> $itin->SetDBData($dbname,'news');
>> $itin->SetDBPassword('<pw>','<username>');
>> $itin->AddDBParam('-recid',$id);
>> $itin->AddDBParam('title',$title);
>> $itin->AddDBParam('teaser',$teaser);
>> $itin->AddDBParam('newsitem',$newsitem);
>> $itinResult=$itin->FMEdit();
>> include_once('news.php');
>> ?>
>>
>> As you can see, I tried to strip out anything that might cause  
>> trouble, in the line where $newsitem is retrieved from the POST form.
>>
>
> hope this helps
>
> ---
> Erik Andreas Cayré
> Spangsbjerg Møllevej 169
> DK-6705 Esbjerg Ø
>
> Home Tel: +45 75150512
> Mobile: +45 40161183
>
> »If you can't explain it simply, you don't understand it well enough.«
> -- Albert Einstein
>
> »If you don't have time to do it right, when will you have time to  
> do it over?«
> -- John Wooden, basketball coach
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list