php pattern problem for xxxxxx-xx-xxxx using all digits
hi all... anybody here know how to set a php pattern for xxxxxx-xx-xxxx using all digits? here is my code, is there any mistake?
$pattic="/(\d{6})-(\d{2})-(\d{4})/";
hi all... anybody here know how to set a php pattern for xxxxxx-xx-xxxx using all digits? here is my code, is there any mistake?
$pattic="/(\d{6})-(\d{2})-(\d{4})/";
have you tried "/^([0-9]{6})-([0-9]{2})-([0-9]{4})$/" ?
It should be the same with \d but sometimes the php functions don't interpret the escaped characters.
Other sample, firstly i want to capture all the text from the textfield then insert into db. Before inserting into db, i have to convert all text that have been captured before into standard english grammer (first letter must be start with big caps).. How can i do that? Any idea?
Other sample, firstly i want to capture all the text from the textfield then insert into db. Before inserting into db, i have to convert all text that have been captured before into standard english grammer (first letter must be start with big caps).. How can i do that? Any idea?
I think you better use css for this sort of thing. text-transform :capitalize will do the trick but if you insist on doing it the php way
but i dont achieves my point.
ex: when i insert text "web programming" but i dont get the actual output like "Web Programming" - an output must be big caps for any first word and both word seperate with single space!
Thanks xwero at all! I cant reply u later, just send it regards bye :p
if(isset($_REQU EST['Submit']))
{
$text = $_POST['name'];
// for the first letter
$string = preg_replace('/^([a-z]{1})/', strtoupper('$1' ),$text);
// for all following words
$string = preg_replace('/ ([a-z]{1})/', strtoupper('$1' ),$text);
echo $string;
}
[/PHP]
if(isset($_REQU EST['Submit']))
{
$text = $_POST['name'];
// for the first letter
$string = preg_replace('/^([a-z]{1})/', strtoupper('$1' ),$text);
// for all following words
$string = preg_replace('/ ([a-z]{1})/', strtoupper('$1' ),$text);
echo $string;
}
[/PHP]
Which output do you get now?
Sorry buddy i still not get an expected result! For example i type a text "web programming" but what i get is "webprogramming ".. Do u have any idea?
if(isset($_REQU EST['Submit']))
{
//capture text from textfield
$text = $_POST['name'];
//convert all text into lowercase then set all any first capital in any words with capital letters
//function ucwords() set any first capital in any words with capital letter
//function strtolower() set all text into lowercase
echo ucwords(strtolo wer($text));
}
Comment