Page 1 of 1

Get rid of blank spaces

Posted: Thu Apr 09, 2009 3:27 pm
by Anarking
Hi there


Im having problem entering something into my database, I need to remove the blank spaces automatically and replace them with '_'


How do I do this?

cheers

Re: Get rid of blank spaces

Posted: Thu Apr 09, 2009 3:29 pm
by nyoka
Assuming you have the data in a variable called $data the follwoing code will work.

Code: Select all

<?php
$data = str_replace(" ", "_", $data);
?>