# Contact Form on One Page

**URL:** <https://forum.getkirby.com/t/contact-form-on-one-page/22167>\
**Category:** Questions\
**Tags:** v3\
**Created:** [May 4, 2021, 4:37pm UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167 "2021-05-04T16:37:52Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kloerdener](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@Kloerdener](https://forum.getkirby.com/u/Kloerdener)\
**Post date:** [May 4, 2021, 4:37pm UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/1 "2021-05-04T16:37:52Z")

</div>

Hello all,

I am in despair.  
I am building a One Page site according to the following instructions: [One-pager site | Kirby CMS](https://getkirby.com/docs/cookbook/templating/one-pager). And there I have a section in which I want to display a contact form. I would like to do this according to the following instructions: [Email contact form | Kirby CMS](https://getkirby.com/docs/cookbook/forms/basic-contact-form).

However, this does not really work. If I use the contact form on a “normal page”, it works. But as soon as I want to use it in a section of my one page site, it no longer works. Does anyone have any experience here?

---

<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:** [May 4, 2021, 6:34pm UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/2 "2021-05-04T18:34:38Z")

</div>

Hey, could you please post your code and where exactly you included it?

---

<div class="post-metadata">

**Author:** ![Kloerdener](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@Kloerdener](https://forum.getkirby.com/u/Kloerdener)\
**Post date:** [May 5, 2021, 11:34am UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/3 "2021-05-05T11:34:33Z")

</div>

I have included the controller as home.php. In the home.php template file I pass the controller data to my contact snippet, where my contact form is located. I did not change any in the controller or in the contact form.

`  
\<?php

```
snippet('header');

foreach($pages->listed() as $section) {
  snippet($section->uid(), ['sectiondata' => $section, 'alert' => $alert, 'data' => $data, 'success' => 
$success]);
}

snippet('footer');

?>

```

`

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [May 5, 2021, 11:52am UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/4 "2021-05-05T11:52:50Z")

</div>

And where does the action attribute of the form go to?

---

<div class="post-metadata">

**Author:** ![Kloerdener](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@Kloerdener](https://forum.getkirby.com/u/Kloerdener)\
**Post date:** [May 5, 2021, 11:57am UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/5 "2021-05-05T11:57:00Z")

</div>

The action goes to the url of the “home” page.

```
action="<?= $page->url() ?>
```

---

<div class="post-metadata">

**Author:** ![pixelijn](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@pixelijn](https://forum.getkirby.com/u/pixelijn)\
**Post date:** [May 5, 2021, 12:17pm UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/6 "2021-05-05T12:17:44Z")

</div>

Ok, next question. What exactly is “it no longer works”? The controller doesn’t do anything at all?

What if you do a

```auto
dump($data);

```

right after the header snippet in the home template?

---

<div class="post-metadata">

**Author:** ![Kloerdener](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@Kloerdener](https://forum.getkirby.com/u/Kloerdener)\
**Post date:** [May 5, 2021, 12:24pm UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/7 "2021-05-05T12:24:49Z")

</div>

A empty pre section appers. "it no longer works” means the page is reloading but nothing happend. the “home” page is there with an empty contact formular. And MailHog doesnt show a mail.

---

<div class="post-metadata">

**Author:** ![Sarah\_Bch](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/sarah_bch/32/10406_2.png) [@Sarah\_Bch](https://forum.getkirby.com/u/Sarah_Bch)\
**Post date:** [May 10, 2021, 8:13am UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/8 "2021-05-10T08:13:49Z")

</div>

Hey 🙂 I have de same problem… have you find the solution ?  
Thank you

---

<div class="post-metadata">

**Author:** ![Sarah\_Bch](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/sarah_bch/32/10406_2.png) [@Sarah\_Bch](https://forum.getkirby.com/u/Sarah_Bch)\
**Post date:** [May 10, 2021, 9:07am UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/10 "2021-05-10T09:07:15Z")

</div>

Ok the answer to integrate form on home page is :

replace this :

```auto
<form action="<?php echo $page->url() ?>" method="POST">

```

by this

```auto
<form action="<?php echo $page->url() ?>/" method="POST">

```

I add just a " / " after my url…

---

<div class="post-metadata">

**Author:** ![Kloerdener](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@Kloerdener](https://forum.getkirby.com/u/Kloerdener)\
**Post date:** [May 12, 2021, 1:38pm UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/11 "2021-05-12T13:38:51Z")

</div>

Hey,

Unfortunately, this did not help me.  
Have you also made the structure on the basis of the two examples?

---

<div class="post-metadata">

**Author:** ![AlterHaudegen](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@AlterHaudegen](https://forum.getkirby.com/u/AlterHaudegen)\
**Post date:** [February 16, 2022, 9:04pm UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/12 "2022-02-16T21:04:14Z")

</div>

Hello,

I have the same problem. I have also made a minimal construction based on the examples. I get the same result as Kloerdener. Does anyone have an idea?

---

<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 16, 2022, 9:21pm UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/13 "2022-02-16T21:21:41Z")

</div>

@AlterHaudegen What exactly are you trying to do? Combine the one pager with the contact form or just integrate the form on the home page?

---

<div class="post-metadata">

**Author:** ![AlterHaudegen](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@AlterHaudegen](https://forum.getkirby.com/u/AlterHaudegen)\
**Post date:** [February 17, 2022, 6:56am UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/14 "2022-02-17T06:56:29Z")

</div>

I am trying to integrate the contact form as a section in the one page.  
I have taken the following two instructions and combined them. However, I have the same problem as Kloerdener

[One-pager site | Kirby CMS](https://getkirby.com/docs/cookbook/templating/one-pager).  
[Email contact form | Kirby CMS](https://getkirby.com/docs/cookbook/forms/basic-contact-form).

---

<div class="post-metadata">

**Author:** ![AlterHaudegen](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@AlterHaudegen](https://forum.getkirby.com/u/AlterHaudegen)\
**Post date:** [February 17, 2022, 3:27pm UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/15 "2022-02-17T15:27:53Z")

</div>

@texnixe I can upload my site folder to github, then you can take a closer look. Would that be helpful?

---

<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 17, 2022, 4:41pm UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/16 "2022-02-17T16:41:34Z")

</div>

@AlterHaudegen Yes, that would help.

---

<div class="post-metadata">

**Author:** ![AlterHaudegen](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@AlterHaudegen](https://forum.getkirby.com/u/AlterHaudegen)\
**Post date:** [February 18, 2022, 2:19pm UTC](https://forum.getkirby.com/t/contact-form-on-one-page/22167/17 "2022-02-18T14:19:33Z")

</div>

I have found the error.  
My submit button did not have a “name” property.

Thank you
