One more problem I could see is that if the user types in an odd number of
spaces like 5 or 7. Wouldn't this replace string only replace spaces all the
even spaces like 2, 4, 6, 8, and so on?


----- Original Message -----
From: "Andrew Brampton" <[EMAIL PROTECTED]>
To: "Stephen" <[EMAIL PROTECTED]>
Sent: Monday, December 09, 2002 5:36 PM
Subject: Re: [PHP] Spaces


> $text = str_replace("  ", "&nbsp;&nbsp;", $_POST['input']);
>
> would be better, since each &nbsp; is a space
>
> $text = str_replace("  ", "&nbsp; ", $_POST['input']);
>
> might work also, but I'm unsure how browsers handle &nbsp; &nbsp; &nbsp;
> .....
>
> Andrew
>
> ----- Original Message -----
> From: "Stephen" <[EMAIL PROTECTED]>
> To: "Andrew Brampton" <[EMAIL PROTECTED]>
> Cc: "PHP List" <[EMAIL PROTECTED]>
> Sent: Monday, December 09, 2002 10:01 PM
> Subject: Re: [PHP] Spaces
>
>
> > So would I just do this?
> >
> > $text = str_replace("  ", "&nbsp;", $_POST['input']);
> >
> >
> > ----- Original Message -----
> > From: "Andrew Brampton" <[EMAIL PROTECTED]>
> > To: "Stephen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Monday, December 09, 2002 4:30 PM
> > Subject: Re: [PHP] Spaces
> >
> >
> > replace more than 1 space in a row with a &nbsp;
> > OR, when outputing their text place a <pre> tag around it
> >
> > Andrew
> >   ----- Original Message -----
> >   From: Stephen
> >   To: PHP List
> >   Sent: Monday, December 09, 2002 9:25 PM
> >   Subject: [PHP] Spaces
> >
> >
> >   I have a article submission thing where the user types in whatever
they
> > want. I've already made it so that when the user pushes enter, it saves
it
> > as a <br> for HTML but how would I do this for spaces also? I'm storing
> the
> > contents in a MySQL database...
> >
> >   Thanks,
> >   Stephen Craton
> >   http://www.melchior.us
> >
> >   "What is a dreamer that cannot persevere?" -- http://www.melchior.us
> >
> >
>
> --------------------------------------------------------------------------
> --
> > --
> >
> >
> >   --
> >   PHP General Mailing List (http://www.php.net/)
> >   To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to