I have a form field called ‘Name’ – but I’d like to save the submission into the DB as First Name & Last Name using a preg expression.
Can some illustrate how if I entered the name ‘John Smith’ into the field a regexp would strip this into First Name – John Surname – Smith
Thanks in advance
Prefer use
split(version php < 5.3.0) orexplodewhich is an alias ofsplitfunction, in your case, you just have to split you fullname with space character' '–
if you build the form that catch firstname and fullname, I will suggest you to split your fullname input field into two input field (firstname and lastname).