i cannot find macthing records before using this, bcoz most of my records got many spaces :( .
solved
[PHP]
$var = str_replace(' ', ' ', 'Micheal Owen'); // with multiple spaces
print $var; // the result
// when query i used this
$SQL = 'select name from player where name = \''.str_replace (' ', ' ', $var).'\''; // working its take all the spaces
...
User Profile
Collapse
-
i've tried this
[PHP]$var = $_POST['MyInput']; // for example "AH 1902" with 2 spaces
$tmp = str_replace(" ", "*", $var);
print "var is : ".$var." ( ".strlen($var). " )";
print "tmp is : ".$tmp." ( ".strlen($tmp). " )";[/PHP]
output :
[HTML]var is : AH 1F02 ( 8 )
tmp is : AH**1F02 ( 8 )[/HTML]...Leave a comment:
-
Multiple spaces become single space when submitting
hie all
i got a form
if i input "Welcome ", with a few spaces, i cannot get all the spaces. the $_POST['MyInput']...Code:<form name="TEST" method=POST action="test.php"> <input type="text" name="MyInput"> <input type="submit" name="ACTION" value="SAVE"> </form>
No activity results to display
Show More
Leave a comment: