Hey, I am making a staff page for my radio site. I am making DJ profiles and because the DJ might or might not have the word DJ on the DJ name it can change.
What I am looking for was a PHP (or Javascript) that removes the word DJ from the variable. I have googled, and I sort of found this:
That doesn't remove the DJ part. Does anybody know how I can do this?
Many thanks!
What I am looking for was a PHP (or Javascript) that removes the word DJ from the variable. I have googled, and I sort of found this:
| Code: |
| <?php
function cleanData($variable, $type, $theDefinedValue = "", $theNotDefinedValue = "") { $variable = (!get_magic_quotes_gpc()) ? addslashes($variable) : $variable; switch ($type) { case "text": $variable = ($variable != "") ? $variable : "NULL"; break; case "long": case "int": $variable = ($variable != "") ? intval($variable) : "NULL"; break; case "double": $variable = ($variable != "") ? doubleval($variable) : "NULL"; break; case "date": $variable = ($variable != "") ? $variable : "NULL"; break; case "defined": $variable = ($variable != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $variable; } $user = $_GET['username']; $dj = cleanData($user, "DJ"); echo "$dj"; ?> |
That doesn't remove the DJ part. Does anybody know how I can do this?
Many thanks!
