arigoh afnan arigoh afnan - 4 months ago 7
PHP Question

combining input from form into 1 rows

i want to combine

fname
and
lname
into a one input

$fname = trim($_POST['fname']);
$lname = trim($_POST['lname']);


and i want input this result into my sql table

function random_username( $length = 4 ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$password = substr( str_shuffle( $chars ), 0, $length );
return $usercode;
}


how about that combining code?

NOTE: *Sorry for my bad english

Answer

Hi if you want to concate firstname and lastname then simply use concatnation

$fname = trim($_POST['fname']);
$lname = trim($_POST['lname']);

$userfullname = $fname." ".$lname; // this will give use your fullname