Last active
February 2, 2018 15:57
-
-
Save gaintsev/ad200dd13508d81a663915ad40d4247c to your computer and use it in GitHub Desktop.
Cockpit Next - Create and Save Form from PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Include Cockpit | |
require_once('admin/bootstrap.php'); | |
// Set name for new form | |
$new_form = 'foo'; | |
// Set data | |
$data = array( | |
'data' => array( | |
'name' => 'Jack', | |
'email' => '[email protected]' | |
) | |
); | |
// Create form | |
cockpit('forms:createForm', $new_form); | |
// Save new form entry | |
$request = cockpit('forms:save', $new_form, $data); | |
// Debug | |
var_dump($request); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment