Re: Spaces

From: Date: Mon, 09 Dec 2002 22:53:28 +0000
Subject: Re: Spaces
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-127564@lists.php.net to get a copy of this message
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" <andrew@bramp.freeserve.co.uk> To: "Stephen" <webmaster@melchior.us> 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" <webmaster@melchior.us> > To: "Andrew Brampton" <andrew@bramp.freeserve.co.uk> > Cc: "PHP List" <php-general@lists.php.net> > 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" <andrew@bramp.freeserve.co.uk> > > To: "Stephen" <webmaster@melchior.us>; <php-general@lists.php.net> > > 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 > > > > > >

« previous php.general (#127564) next »