You are here: Re: [PHP] Split command problem « PHP « IT news, forums, messages
Re: [PHP] Split command problem

Posted by Greg Donald on 04/11/05 07:33

On Apr 10, 2005 8:27 PM, Russ <russbucket@centurytel.net> wrote:
> 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]");

Where is your 'name' function and what does it do?

I'd do:

$name = explode( ' ', $_POST[ 'username' ] );
echo "First Name: $name[0] Last Name: $name[1]";

> //echo "First Name: $fname; Last Name: $lname\n;
> echo "first letter is uppercase";
> }
> else
> {
> echo "first letter is not uppercase";
> }


--
Greg Donald
Zend Certified Engineer
http://destiney.com/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация