Forum
Input field in template which captures page name list detail page name
Hi
I'm using a list and detail page setup with a form on the detail page. I'm using the forms app for the forms on these detail pages.
Whenever a form is submitted I would like to be able to show which detail page the form has come from.
At the moment I am just showing the page slug.
On the detail layout I have the following code which is used to get the page slug.
<?php
PerchSystem::set_var('page', $_SERVER['SCRIPT_NAME']);
perch_content_custom('Form', array(
'template' => 'enquiry_form.html',
));
?>
Below is my enquiry form template and the hidden input field is the one which gives the page slug
<perch:input type="hidden" label="Artist Name and Work" id="page" value="<perch:content id="page" escape="true" />" />
Would you know how I would go about getting the page title and then the name of the detail page i.e (Main page tile) "Product" (detail page title) "Product 1"
Thanks for any help with this.
Thanks for this Drew. What would into the Equiry Form template under the hidden input field?
At the moment I just have
Give it the ID of any of your fields from the content region.
I've tried different IDs but it doesn't seem to be working. The field is just appearing blank in the form when I look at it through the forms app. I must be missing something.
I have entered this code into the product.detail.php layout
and in the enquiry_form.html template the hidden field is
I'm looking to get both the page title and the product title so will using 1 ID in this area do that?
What does
<perch:showall />
give you?Hi Drew it shows this
Can you show me what you're doing after the
PerchSystem::set_vars
?This code is in the product.detail.php layout
Then in the enquiry_form.html template this is all the code. The hidden input field is the one where I'm trying to pull in the list page title and the product detail title.
Can you replace:
with: