Web Hosting Talk







View Full Version : 1 more PHP question


us0r
08-17-2004, 01:28 PM
I am trying to strip the space out of a name and here is what I got:


$ryan1 = $_REQUEST["name"];
$replaceme = str_replace(" ", $ryan1, $replacement);
$table_name = $ryan1;


can someone help me fix that?

name i put test ing (with the space) but I need it to take out any space it may have.

thanks,
ryan

christowang
08-17-2004, 01:35 PM
One Liner...


$table_name = str_replace(" ", "",$_REQUEST["name"]);

cblc3kw
08-17-2004, 01:45 PM
And if you want trim spaces from left and right use trim()

$name = trim($name);