RE: a function question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try this i got this working without any problems prints everything out nice an neetly


<?php $mail = "FOJOMO@xxxxxxxxx"; $user = "patrick"; /* comment function to get on screen function usermail($user,$mail) { */

	global $user;
        global $mail;

$user = ucwords($user); // capitalizes the 'p' in patrick
$mail = strtolower($mail); // converts all of FOJOMO into lower case


 if (preg_match("/@/" , $mail)) { // searches for the '@' sign

 // Used preg_match not strstr

 /*

 Place array details here that will work
 i do not know of arrays yet so i can not help here

 */

echo "Valid email address and username details here<p>\n" . $user . "\n<p>\n" . $mail . "<p>\n";

} else {
print "Please enter a valid e-mail address"; //default if test fails to //find the '@' sign
}


  // Function close
  //}


?>



Dean "The Insane Guy" Hayes


<-- I design and i redesign but still i never designed true beauty like you -->


~~~ Call me Insane call me Crazy but there is one thing i know i am That is someone that shall reach peoples hearts with words ~~~

~~ PHP seems easy enough but what about this ASP now that looks hard ~~




From: Patrick Roane <fojomo@xxxxxxxxxxxxx> To: php-windows@xxxxxxxxxxxxx Subject: a function question Date: Wed, 29 Dec 2004 21:06:43 -0800 (PST)

I am trying to create a function that works with two
arguments. the 1st needs to be a suername. The 2nd
needs to be an email address. Next, I have to use case
conversion functions to capitalize the first letter of
the username and convert the email add. to lowercase
characters and finaly check that it contains the @
sign. If I can't find the @ character, return false:
otherwise, I return an array containing the converted
arguments.

Here is my code (which I can't get to work):

<?php


$mail = "FOJOMO@xxxxxxxxx"; $user = "patrick";

	function usermail( $user, $mail ) {

	global $user;
        global $mail;

        $user; = ucwords( $user ); // capitalizes the
    //'p' in patrick
        $mail; = strtolower( $mail ); // converts all
//of FOJOMO into lower case



  if ( strstr( $mail ), "@" )) {
    // searches for the '@' sign
  user_array = explode("-", $user, $mail); // this
//function (explode) creates the array
			} else {
	print "Please enter a valid e-mail address";   //
default if test fails to //find the '@' sign


}



?>

=====

----------------
"forget your lust for the rich man's gold. All that you need, is in your soul. You can do this if you try. All that I want for you my son, is to be satisfied"


  ~ Lynard Skynard

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux