Jump to content

[SOLVED] strtolower and ucwords problem?


shadiadiph

Recommended Posts

I have been using ucwords($_POST items such as names so if the user inputs their name in lower case it should come out properly example simon lee becomes Simon Lee but one problem I have come accross is if the user types simon LEE it saves as Simon LEE ucwords doesn't seem to work with uppercase words?? I tried strtolower(ucwords($_POST to try to force it to lower string then to ucwords but that doesn't work any solutions out there?

Link to comment
https://forums.phpfreaks.com/topic/146101-solved-strtolower-and-ucwords-problem/
Share on other sites

I have been using ucwords($_POST items such as names so if the user inputs their name in lower case it should come out properly example simon lee becomes Simon Lee but one problem I have come accross is if the user types simon LEE it saves as Simon LEE ucwords doesn't seem to work with uppercase words?? I tried strtolower(ucwords($_POST to try to force it to lower string then to ucwords but that doesn't work any solutions out there?

 

Try something like

 

<?php

$query = $_GET['query'];
$query = strtolower($query);
$query = ucwords($query );
echo($query);

?>

mm i have tried this which is producing the error

 

Parse error: syntax error, unexpected ')' in /home/asiapaci/public_html/site/submit/newslsubmit.php on line 7

 

$name  = strtolower($_POST["name"]));
$email = strtolower($_POST["email"]);
$name = ucwords($name);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.