1. Go to this page and download the library: Download burntcaramel/perforated library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
burntcaramel / perforated example snippets
define ('EXAMPLE_SUBMIT_VIDEO', 'submitVideo');
define ('BURNT_ENDASH', "\xE2\x80\x93");
// This can be written using PHP arrays, or loaded from a JSON file.
$formOptions = array(
'baseID' => EXAMPLE_SUBMIT_VIDEO,
// All the entries to be used in the form.
'entries' => array(
'videoLink' => array(
'title' => 'Video link '.BURNT_ENDASH.' Vimeo / YouTube',
'value' => '',
'type' => 'url',
'
'' => 'text'
),
'companies' => array(
'title' => 'Who are the companies and teams behind the video?',
'value' => '',
'type' => 'text',
'multipleLines' => true
),
'businessEmail' => array(
'title' => 'Is there an email we can contact for business enquiries?',
'value' => '',
'type' => 'email'
)
),
// This is the actual structure of the form as it is displayed, grouped into subsections.
'structure' => array(
array(
'id' => 'videoInfo',
'entries' => array('videoLink')
),
array(
'id' => 'aboutSubmitter',
'dependentOn' => 'loggedOut', // Only uses (shows and processes) this if the 'loggedOut' external value is on.
'alsoProcessIf' => 'loggedIn', // These entries are automatically filled (see 'automaticallyFillEntriesFrom' further down) so process them even if its dependency is off.
'entries' => array('name', 'email')
),
array(
'id' => 'connectionQuestion',
'entries' => array('helpedCreate')
),
array(
'id' => 'connection',
'dependentOn' => 'helpedCreate', // Only show this if the 'helpedCreate' checkbox is on.
'entries' => array('role', 'location', 'companies', 'businessEmail')
)
),
// Automatically uses external values to fill in entries.
'automaticallyFillEntriesFrom' => array(
// Using external value 'loggedInMember', grab the following values:
'loggedInMember' => array(
'name' => 'name', // Entry value for 'name' is automatically filled from $externalValues['loggedInMember']['name']
'email' => 'emailAddress', // Entry value for 'email' is automatically filled from $externalValues['loggedInMember'][emailAddress]
)
)
);
// Check if form is being submitted and if so, process the submitted entries.
$resultsForSubmitVideo = perforatedFormCheckAndProcess($formOptions, array(
'externalValues' => 'exampleExternalValues' // Options and callbacks are kept separate to enabled $formOptions to be created as pure JSON.
));
else:
// Display the form, which does a POST request to the current page.
// If $resultsForSubmitVideo['entriesAreValid'] is false, then the errors will be displayed within the form.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.