|
Posted by Prathaban Mookiah on 04/12/05 07:06
I guess you are trying to create an array by the name 'name' and assign two
elements to it by calling name($fname, $lname). Am I correct?
I think it does not work that way. Try list($fname, $lname) = ......
Then the variable $fname and $lname will contain the first and last names.
list($fname, $lname) = split('[/\s+/]', "$_POST[username]");
Cheers,
Prathap
---------- Original Message -----------
From: Russ <russbucket@centurytel.net>
To: PHP General <php-general@lists.php.net>
Sent: Sun, 10 Apr 2005 18:27:34 -0700
Subject: [PHP] Split command problem
> I have been trying to get the following code working. I keep getting
> an error on line nine. It looks simular to the example in the PHP
> online manual. If I substitute a print command for line nine I get
> the correct information from $_POST[username]. I must be missing or
> have an extra a quote but I cannot figure out where.
>
> <?php
> //check for required fields from the form
> if ((!$_POST[username]) || (!$_POST[password])) {
> header("Location: memberlogin15.7.php");
> exit;
> }
> if(preg_match("/[A-Z]/", substr("$_POST[username]", 0, 1)))
> {
> name($fname, $lname) = split('[/\s+/]', "$_POST[username]");
> //echo "First Name: $fname; Last Name: $lname\n;
> echo "first letter is uppercase";
> }
> else
> {
> echo "first letter is not uppercase";
> }
>
> Any help will be appreciated.
> --
> Russ
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
------- End of Original Message -------
Navigation:
[Reply to this message]
|