# Form on a Single Page in a Package

**URL:** <https://forums.concretecms.org/t/form-on-a-single-page-in-a-package/6486>\
**Category:** Developing with Concrete\
**Created:** [November 9, 2023, 10:06pm UTC](https://forums.concretecms.org/t/form-on-a-single-page-in-a-package/6486 "2023-11-09T22:06:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ozzyandy](https://forums.concretecms.org/user_avatar/forums.concretecms.org/ozzyandy/32/3817_2.png) [@ozzyandy](https://forums.concretecms.org/u/ozzyandy)\
**Post date:** [November 9, 2023, 10:06pm UTC](https://forums.concretecms.org/t/form-on-a-single-page-in-a-package/6486/1 "2023-11-09T22:06:20Z")

</div>

Hi.  
Using Concrete Cms 9.2.1  
I am trying to create a single\_page within a package that is not in the dashboard, And a form to submit to a controller.

I have the following code which installs the package and creates my User page, But when I press submit I keep getting a “Page not found”.

Can someone please help identify what I’m doing wrong?

_packages/my\_package/controllers/single\_page/committee/bookings/create.php_

```auto
	<?php
		namespace Application\Controller\SinglePage;

		use Concrete\Core\Page\Controller\PageController;
		
		public function action_submit_booking($bID = false)
		{
			echo 'Email - ' . $this->get('emailAddr');
		}

```

_packages/my\_package/single\_pages/committee/bookings/create.php_

```auto
	<?php
	defined('C5_EXECUTE') or die('Access Denied.');

	/** @var \Concrete\Core\View\View $view */
	/** @var \Concrete\Core\Form\Service\Form $form */
	?>

	<form method="post" action="<?= $view->action('submit_booking'); ?>">
		<fieldset>

			<div class="form-group">
				<label for="emailAddr">Email:</label>
				<input type="text" id="emailAddr" name="emailAddr">
			</div>

		</fieldset>

		<div class="ccm-dashboard-form-actions-wrapper">
			<input type="submit" value="Submit">
		</div>
	</form>

```

_packages/my\_package/install/singlepages.xml_

```auto
	<?xml version="1.0"?>
	<concrete5-cif version="1.0">
		<singlepages>
			<page name="Create Booking"
				  path="/committee/bookings/create"
				  filename="/committee/bookings/create.php"
				  pagetype=""
				  description=""
				  package="lodge_bookings"/>
		</singlepages>
	</concrete5-cif>

```

Thank you

---

<div class="post-metadata">

**Author:** ![dbuonomo](https://forums.concretecms.org/user_avatar/forums.concretecms.org/dbuonomo/32/3575_2.png) [@dbuonomo](https://forums.concretecms.org/u/dbuonomo)\
**Post date:** [November 9, 2023, 10:43pm UTC](https://forums.concretecms.org/t/form-on-a-single-page-in-a-package/6486/2 "2023-11-09T22:43:03Z")

</div>

Not sure this will help, but you have bID as a URL parameter for the action method. The method has a default value of false, but if a boolean value is not included in the URL, can the request be dispatched to the proper method?

As a test, you could change the form tag to the following:

```auto
<form method="post" action="<?= $view->action('submit_booking'); ?>/1">

```

---

<div class="post-metadata">

**Author:** ![ozzyandy](https://forums.concretecms.org/user_avatar/forums.concretecms.org/ozzyandy/32/3817_2.png) [@ozzyandy](https://forums.concretecms.org/u/ozzyandy)\
**Post date:** [November 9, 2023, 11:26pm UTC](https://forums.concretecms.org/t/form-on-a-single-page-in-a-package/6486/3 "2023-11-09T23:26:53Z")

</div>

> [@dbuonomo](#):
>
> you could change the form tag to the following:

Thank you for your reply but all that did was add /1 to the URL and I still get a “page not found”.  
I also removed the =false but no luck there either.

---

<div class="post-metadata">

**Author:** ![ozzyandy](https://forums.concretecms.org/user_avatar/forums.concretecms.org/ozzyandy/32/3817_2.png) [@ozzyandy](https://forums.concretecms.org/u/ozzyandy)\
**Post date:** [November 9, 2023, 11:28pm UTC](https://forums.concretecms.org/t/form-on-a-single-page-in-a-package/6486/4 "2023-11-09T23:28:18Z")

</div>

Does anyone know if there is any documentation on how to set up a single page within a package that is not a Dashboard page and has a form to submit to a controller?

I have looked everywhere and I cannot find any examples.

---

<div class="post-metadata">

**Author:** ![JohntheFish](https://forums.concretecms.org/user_avatar/forums.concretecms.org/johnthefish/32/3767_2.png) [@JohntheFish](https://forums.concretecms.org/u/JohntheFish)\
**Post date:** [November 10, 2023, 4:03am UTC](https://forums.concretecms.org/t/form-on-a-single-page-in-a-package/6486/5 "2023-11-10T04:03:32Z")

</div>

For blocks, the method name starts “action\_”, so `action_whatever()`. For single pages, you don’t nee the prefix, so just `whatever()`

---

<div class="post-metadata">

**Author:** ![ozzyandy](https://forums.concretecms.org/user_avatar/forums.concretecms.org/ozzyandy/32/3817_2.png) [@ozzyandy](https://forums.concretecms.org/u/ozzyandy)\
**Post date:** [November 10, 2023, 6:05am UTC](https://forums.concretecms.org/t/form-on-a-single-page-in-a-package/6486/6 "2023-11-10T06:05:28Z")

</div>

Thank you for your reply.  
I have tried both and I still get “Page not found” when pressing submit in the form.

---

<div class="post-metadata">

**Author:** ![hutman](https://forums.concretecms.org/user_avatar/forums.concretecms.org/hutman/32/6198_2.png) [@hutman](https://forums.concretecms.org/u/hutman)\
**Post date:** [November 10, 2023, 2:20pm UTC](https://forums.concretecms.org/t/form-on-a-single-page-in-a-package/6486/7 "2023-11-10T14:20:15Z")

</div>

It looks like you have an incorrect namespace on your controller, a missing class definition, and an incorrect function name. It should be

```auto
<?php
Concrete\Package\MyPackage\Controller\SinglePage\Committee\Bookings;

use Concrete\Core\Page\Controller\PageController;

class Create extends PageController
{
	public function submit_booking() {
		echo 'Email - ' . $this->get('emailAddr');
	}
}

```
