Form on a Single Page in a Package

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

	<?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

	<?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

	<?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

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:

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

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.

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.

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

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

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

<?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');
	}
}