Hi,
I have a contact form with a name field.
In this name field the user will enter there full name i.e. "Bill Smith"
My question is: how can I split up this string so that I can insert both the first and last name into seperate fields in a database?
Thanks.
disecting a string
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Code: Select all
$names = explode(" ", $_POST['name']);
$first_name = $names[0];
$last_name = $names[1];- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London