Post to third party after submit


//Post Form
function post_form($entry,$form){
$post_url = '';
$body = array(
'firstName' => $entry[1],
'lastName' => $entry[2],
'email' => $entry[3]

//Send Form
function send_form($post_url,$body){
$request = new WP_Http();
$response = $request->post($post_url, array('body' => $body));

//Form Actions
add_action('gform_after_submission', 'post_form', 10, 2);


Disable form submit on enter

<form action="sent.asp" method="post" onkeypress="return disableEnterKey(event);">

<script language="JavaScript">
function disableEnterKey(e)
var key;

key = window.event.keyCode; //IE
key = e.which; //firefox

if(key == 13)
return false;
return true;

CDO SendMail Script

email = ""
'check for email address...
if (email <> "") then 'need an email addy

Set Mail = Server.CreateObject("CDO.Message")

Mail.Configuration.Fields.Item ("") = 2 'Send the message using the network (SMTP over the network).
Mail.Configuration.Fields.Item ("") = "" 'SMTP link to your server
Mail.Configuration.Fields.Item ("") = ***Port ID*** 'SMTP Port
Mail.Configuration.Fields.Item ("") = 1 'Use SSL for the connection
Mail.Configuration.Fields.Item ("") = 60

Mail.Configuration.Fields.Item ("") = 1 'basic (clear-text) authentication
Mail.Configuration.Fields.Item ("") = "" 'email account actually sent from
Mail.Configuration.Fields.Item ("") = "password" 'password for email account from above


Mail.From = "" 'email you want it to be sent from

Mail.To = "" 'email you want it sent to

Mail.HTMLBody = "Body Content Goes Here" 'content ofemail

Mail.Subject = "Subject" 'subject of email

On Error Resume Next

if Err <> 0 Then
Response.Write "<font color=red size=+1>An error occurred while sending the email....</font>"
response.write("Thank you.") 'Thank you for sending email
end if 'error
response.write("No Email submitted. Please try again") 'Need email to send to to process
end if 'need an email


Select dropdown value

<script type="text/javascript">

var w = document.tvltNewPost.tvltNewCategory.selectedIndex;
var selected_text = document.tvltNewPost.tvltNewCategory.options[w].text;


Array of select options


$selected_ratio = $_POST['selected_ratio'];
$ratio_array = explode(',', $selected_ratio);

$the_width = $ratio_array[0];
$the_height = $ratio_array[1];
$the_name = $ratio_array[2];
$aspect_ratio = $ratio_array[3];


<form action="" method="post">
<select class="select_field" name="selected_ratio">
<option value="1280,720,HD 720,16:9" <?php if($selected_ratio == '1280,720,HD 720,16:9') echo 'selected="selected"';?>>HD 720</option>
<option value="1920,1080,HD 1080,16:9" <?php if($selected_ratio == '1920,1080,HD 1080,16:9') echo 'selected="selected"';?>>HD 1080</option>
<input class="calculate_btn" name="" type="submit" value="Calculate Ratio" />


class HypAjaxObject{
private static $instance;
private static $version;
private $_version;
private $_div_id;
private $_div_class = 'hyp-ajax-object';
private $_file_urls = array();

private function __construct($div_id,$here){
$this->_div_id = $div_id;
$this->_version = self::$version;
if($here) $this->drop_target();
public static function create($div_id,$here = false){
self::$version = 1;
self::$instance = new HypAjaxObject($div_id,$here);
self::$version += 1;
self::$instance = new HypAjaxObject($div_id,$here);
return self::$instance;

//Public Functions
public function get_file($url){
echo "javascript:hypAjaxLoad('$this->_div_id','$url');";
public function get_urls(){
return $this->_file_urls;
public function get_version(){
return $this->_version;
public function get_data(){
$form_name = $_POST['hyp_ajax_data'];
return $_SESSION['hyp_ajax'][$form_name];
public function close_link(){
echo "javascript:document.getElementById('$this->_div_id').innerHTML = '';";
public function drop_target(){
<div id="<?php echo $this->_div_id ?>" class="<?php echo $this->_div_class ?>"></div>

//Private Class Functions
private function check_post_data(){
$form_name = $_POST['hyp_ajax_data'];
if($_POST == $_SESSION['hyp_ajax'][$form_name]['post']) return;
$_SESSION['hyp_ajax'][$form_name]['post'] = $_POST;
$_SESSION['hyp_ajax'][$form_name]['get'] = $_GET;
<script type="text/javascript">hypAjaxLoad('<?php echo $this->_div_id ?>','<?php echo $_POST['hyp_ajax_url'] ?>');</script>
private function check_form_reset(){
$div_id = $this->_div_id;
$form_name = $_POST['hyp_ajax_data'];
private function print_javascript(){
<script type="text/javascript">
var currentUrl;

function hypAjaxLoad(target,url){
if(currentUrl == url){
document.getElementById(target).innerHTML = '';
currentUrl = '';
else currentUrl = url;

if(window.XMLHttpRequest) xmlhttp = new XMLHttpRequest();
else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");//For Ie5+Ie6

xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) document.getElementById(target).innerHTML = xmlhttp.responseText;

Built using a Polyton Design Pattern
By Adam J Nowak ~

An Ajax loader for PHP programmers. This class allows you to harness the power of Javascript's XMLHttpRequest capability, without having to write a single line of Javascript code.

Public Methods:

Constructor method. Second argument of true creates the div which will contain the loaded file immediately on instantiation. Pass true only if you want your trigger above the loaded ajax content
Ex1: $ajax_object = HypAjaxObject::create('main-ajax-target',true);

Instance version number,
Ex2: $ajax_object->get_version();

Location of the file to load dynamically. Place this call within a link href or a javascript onlclick attribute. Loading php files with this methos is especially powerful.
Ex3: <a href="<?php $ajax_object->get_file('myfile.php') ?>">Load Content</a>
Ex4: <span onclick="<?php $ajax_object->get_file('myfile.php');">Load Content</span>

Returns an array of the current urls of the files to be loaded with ajax for the object.

Returns an array of the data posted by the form for the object

Call this within an a href or an onclick attribute in order to create a "Close Ajax Div" button.

Drop target creates the div which will contain the loaded file. The target will automatically have the css id and class based on the constructor, create(); If you want your trigger above the loaded ajax content you must drop a target below the trigger within the html code. If you want your trigger below the loaded content then just pass true for the second argument in the constructor as in Ex1.
Ex5: $ajax_object->drop_target();

What to Do?

Upload the file
1 - Upload a file to your server which will be loaded into your target div. I recommend just using a php file to get started. Just keep in mind that php runs on the server so ajax is loading the output of the file not the script as would be the case with an include(); function.
2 - If you are going to use html forms in your loaded content make sure to call session_start(); at the top of the php script you are loading. This class stores all post data in a session to improve dynamic form submittal.

Create Instance
1 - Use static method to instantiate
2 - Constructor is private. *Don't Use: $var = new HypAjaxObject();

Create a Trigger
1 - Use a link href or a javascript onclick attribute and call the get_file('myfile.php'); method within the quotes.

Drop a Target
1 - If you pass true as the second argument your target has already been dropped. See Ex1
2 - Set the location of the div to load the ajax content by calling the drop_target(); method.


HypAjaxObject markup example - Target Window above the Trigger:

<?php $ajax_object = HypAjaxObject::create('main-ajax-target',true); ?>
<a href="<?php $ajax_object->get_file('myfile.php') ?>">Load content with link</a>

HypAjaxObject markup example - Target Window below the Trigger:
Use this method assures you can move the target div anywhere you want in the html and not worry about the class not having been loaded yet.

<?php $ajax_object2 = HypAjaxObject::create('main-ajax-target2'); ?>
<p onclick="<?php $ajax_object2->get_file('myfile.php');?>">Load content onclick</p>
<?php $ajax_object2->drop_target();?>


This is a self submitting form example to be put in a dynamically loaded php file:

<?php session_start();?>

<form name="test_form" action="?testget=yes" method="post">
<label>Test Field</label><br />
<input class="input" name="test_input" size="60" type="text" />

<!-- Hyp Ajax Fields -->
<input name="hyp_ajax_data" type="hidden" value="test_form" /><!-- Use this field to store the form post and get data in a session -->
<input name="hyp_ajax_url" type="hidden" value="<?php echo $_SERVER['REQUEST_URI']?>" /><!-- Use this to make the form self submitting -->

<input class="submit_btn" name="submit" type="submit" value="Submit" />
<input name="reset" type="submit" value="Reset" />

<p>Here is the content of the field: <strong><?php echo $_SESSION['hyp_ajax']['test_form']['post']['test_input']; ?></strong></p>

Super Simple Form Formatting

<style type="text/css">

#formID label { float: left; width: 100px; font-weight: bold; line-height: 24px;}
.formItem {clear: both; margin-bottom: 5px;}
.formFieldText {width: 100px; height: 20px; color: #444444;}


<form action="" method="post" id="formID">

<div class="formItem">
<label for="firstName">First Name</label>
<input class="formFieldText" type="text" value="" name="firstName" id="firstName" >

<div class="formItem">
<input type="submit" name="submit" value="Submit The Form">