# Specific fields not recorded by front-end registration form

**URL:** <https://forum.getkirby.com/t/specific-fields-not-recorded-by-front-end-registration-form/24783>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 20, 2022, 11:58pm UTC](https://forum.getkirby.com/t/specific-fields-not-recorded-by-front-end-registration-form/24783 "2022-02-20T23:58:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 20, 2022, 11:58pm UTC](https://forum.getkirby.com/t/specific-fields-not-recorded-by-front-end-registration-form/24783/1 "2022-02-20T23:58:37Z")

</div>

Hi everyone,

I’m setting up a registration form in my frontend web app.  
My new user is well created (name, email and password).  
But impossible to get the firstname or lastname fields stored…  
And so getting them setting in the corresponding fields of the panel.  
Any idea please?  
Many thanks !

Here is my controller code :

---

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 20, 2022, 11:59pm UTC](https://forum.getkirby.com/t/specific-fields-not-recorded-by-front-end-registration-form/24783/2 "2022-02-20T23:59:52Z")

</div>

Here is my “register” controller’s code :

```auto
<?php

	return function ($site, $kirby) {

		//if($kirby->user()) go('/');

		$error = null;
		$success = null;

		if( $kirby->request()->is('POST') and get('register') ) {
			//if(!empty(get('website'))) {
			//go('login');
			//exit;
			//}

			try {
				$password = esc(get('password'));
				$confirm = esc(get('password_confirm'));

				if(v::same($password, $confirm)) {

					// Le nom d'utilisateur sera l'adresse courriel avec la ponctuation supprimée.
					// Les utilisateurs finaux ne l'utiliseront pas, nous avons juste besoin d'un ID unique pour le compte.
					//$username = str::slug(get('email'),'');

					$user = $kirby->users()->create([
						'name' => esc(get('name')),
						'firstname' => strip_tags(get('firstname')),
						'lastname' => strip_tags(get('lastname')),
						'email' => esc(get('email')),
						'password' => esc(get('password')),
						'language' => 'fr',
						'role' => 'wanted_role'
					]);

					$success = 'Compte créé : veuillez vérifier votre boîte email !';

					// Build the email text
					$to = $user->email();
					$from = 'myemail@email.com';
					$subject = 'Création de votre compte';
					
					$kirby->email([
						'to' => $to,
						'from' => $from,
						'subject' => $subject,
						'template' => 'register',
						'data' => [
							'name' => $user->name(),
							'email' => $user->email(),
							'text' => 'Thank you for registering on the link below to activate your account and choose your password.'
						]
                	]);

				} else {
					$error = 'Les mots de passe doivent être identiques !';
				}
		
			} catch(Exception $e) {
				$error = true;
			}
		}

		return compact('error', 'success');

	};

```

---

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 21, 2022, 12:01am UTC](https://forum.getkirby.com/t/specific-fields-not-recorded-by-front-end-registration-form/24783/3 "2022-02-21T00:01:27Z")

</div>

The form part of my registrer template page :

```auto
<div class="row">
	<div class="form-group col-md-6 mb-4">
		<label for="firstname" class="fw-bold">Prénom</label>
		<input name="firstname" id="firstname" type="text" class="form-control form-control-lg" value="<?= get('firstname') ?>" required />
</div>
	<div class="form-group col-md-6 mb-4">
		<label for="lastname" class="fw-bold">Nom</label>
		<input name="lastname" id="lastname" type="text" class="form-control form-control-lg" value="<?= get('lastname') ?>" required />
	</div>
</div>

```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 21, 2022, 7:26am UTC](https://forum.getkirby.com/t/specific-fields-not-recorded-by-front-end-registration-form/24783/4 "2022-02-21T07:26:25Z")

</div>

> [@SimTheGeek](#):
>
> ```auto
> 'firstname' => strip_tags(get('firstname')),
> 'lastname' => strip_tags(get('lastname')),
> 
> ```

Content fields need to go into the `content` array:

```auto
$user = $kirby->users()->create([
  'name' => esc(get('name')),
  'email' => esc(get('email')),
  'password' => esc(get('password')),
  'language' => 'fr',
  'role' => 'wanted_role',
  'content' => [
    'firstname' => strip_tags(get('firstname')),
    'lastname' => strip_tags(get('lastname')),
  ],

]);

```

---

<div class="post-metadata">

**Author:** ![SimTheGeek](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/simthegeek/32/9381_2.png) [@SimTheGeek](https://forum.getkirby.com/u/SimTheGeek)\
**Post date:** [February 21, 2022, 8:32am UTC](https://forum.getkirby.com/t/specific-fields-not-recorded-by-front-end-registration-form/24783/5 "2022-02-21T08:32:56Z")

</div>

Thanks again and again for your help and solutions @texnixe🙏 !  
Kirby’s so gorgeous !!!

---

<div class="post-metadata">

**Author:** ![mickaeldurand](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mickaeldurand/32/8022_2.png) [@mickaeldurand](https://forum.getkirby.com/u/mickaeldurand)\
**Post date:** [June 21, 2022, 10:08pm UTC](https://forum.getkirby.com/t/specific-fields-not-recorded-by-front-end-registration-form/24783/6 "2022-06-21T22:08:56Z")

</div>

Hello @SimTheGeek , would you have the code a bit more complete to see exactly how you did it?

In particular the template?
