Jump to content

[SOLVED] Lowercase only


NoDoze

Recommended Posts

Hmmmm....ok.... I think I'm closer, but still don't understand....

 

This is from my code:

$user_id = $_POST['user_id'];

 

How would I apply this to it?

$string = "This-Is An! Example234";

$string = preg_replace('/[^0-9a-z]*/','',strtolower($string));

 

Would it be...?

$user_id = preg_replace('/[^a-z]*/','',strtolower($_POST['user_id']));

 

Thanks!

 

Link to comment
Share on other sites

What do you mean?  My code does use $_POST.  This code is assuming the user hits 'submit' and the form is submitted to the processing page/script.  With $_POST all you do is call the name of the input field.  So if you have:

 


 

Then you would get the submitted information by calling...

 

$user_id = $_POST['NoDoze'];

 

Is this what you're asking or helpful?

 

 

Link to comment
Share on other sites

Worked perfectly!

 

But now I realize I have another problem... the same variable is creating the user folder too!

 

So...

mkdir ("/home/dir/dir/ftp/{$_POST['user_id']}")

is creating the directory with the mixed caps.

 

how would I alter this to take lowercase only?

mkdir ("/home/dir/dir/ftp/$user_id")

So that it would take the defined variable from above instead in lowercase?

 

Thanks

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.