-
-
Save billerickson/adcb5f261164932be02f to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* EA CRM. | |
* | |
* Basic API | |
* | |
* @package EA_CRM | |
* @since 1.0.0 | |
* @copyright Copyright (c) 2014, Jared Atchison & Bill Erickson | |
* @license GPL-2.0+ | |
*/ | |
require_once( 'inc/init.php' ); | |
// Check for API form submission | |
if ( isset( $_POST['secret'] ) && $_POST['secret'] == $settings['api_secret'] ) { | |
// Fields we are using | |
$fields = array( | |
'name' => '', | |
'email' => '', | |
'phone' => '', | |
'url' => '', | |
'date' => '', | |
'referral' => '', | |
'referral_other' => '', | |
'status' => '', | |
'budget' => '', | |
'timeframe' => '', | |
'inquiry' => '', | |
'services' => '', | |
); | |
foreach( $fields as $key => $value ) { | |
if( isset( $_POST[$key] ) && ! empty( $_POST[$key] ) ) | |
$fields[$key] = $_POST[$key]; | |
} | |
// Insert values into database | |
$add = $db->insert( 'entries', $fields ); | |
$id = $db->insertId(); | |
echo "New entry saved. Entry ID is $id"; | |
} else { | |
die(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment