We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum


Thread tagged as: Question, Problem, Forms

Post hidden content in a form


I followed the "list and detail pages" to set up an area on the website where users can book onto training sessions.

I currently have...

  • multiple course pages, each listing x3 regional options
  • Once a user has clicked on a regional option it shows the detail - along with the option to book a place

When a user clicks book now I want it to go to a booking page showing the course title and regional detail, along with a form for the user to input details.

Where I'm stuck at

I managed to pull the course title and regional detail into the booking page as a summary, but

I cant figure out how to submit the course title and regional detail through the form, I've tired hidden fields using the ID's I set but it just return blank on submission.

This is how i have pulled the details content onto the booking page

$sql = "SELECT pci.indexKey, pci.indexValue, pp.pageTitle FROM perch2_content_index pci, perch2_pages pp WHERE pci.pageID = pp.pageID AND pci.itemID = ".$DB->pdb($_GET['id'])." GROUP BY pci.indexKey ORDER BY pci.indexID DESC"; $rows = $DB->get_rows($sql); // Assign variables to each array value foreach ($rows AS $value) { $formVars[$value['indexKey']] = $value['indexValue']; $formVars['pageTitle'] = $value['pageTitle']; } echo '<div class="small-12 columns"><h3>' . $formVars['pageTitle'] . ':</h3></div><hr />'; echo '<ul class="small-block-grid-2">'; echo '<li><b>Region:</b> ' . $formVars['region'] . '</li>'; .........

Any guidance would be a massive help

Jon Pudny

Jon Pudny 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can use PerchSystem::set_var() to pass field values into the form template. e.g.

PerchSystem::set_var('course_id', 1234);


<perch:input id="course_id" type="hidden" />