<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>

<style type="text/css">

    form{

        visibility:hidden;

    }

</style>

<?php

$cid = (int)$_GET['cid'];

        global $wpdb;

        $table_name = $wpdb->prefix . "social_post_press";  

        if($cid <= 0 ){

            echo json_encode(array('error' => 'No campaign found'));

        }else{

            $query = sprintf('select * from '.$table_name.' where id = %d',$cid);

            $result = $wpdb->get_results($query);

            //print_r($result);

            // var_dump($result[0]->$social_post_press_optin_code);

            // var_dump($result[0]->$social_post_press_optin_form);

            $result[0]->social_post_press_optin_form = unserialize($result[0]->social_post_press_optin_form);

            //$result->awber_url='http://socialviralapps.com/wp/handle_aweber?cid='.$cid;

            echo stripslashes($result[0]->social_post_press_optin_code);

        }

?>



<script type="text/javascript">

    jQuery(document).ready(function(){

        <?php

            foreach($_POST as $key=>$val){

                ?>

                    jQuery("input[name=<?php echo stripslashes($key); ?>]").attr("value","<?php echo stripslashes($val); ?>");

                <?php

            }

        ?>

        jQuery("form").attr("target","");

        jQuery("form input[name=submit]").remove();

        jQuery("form").submit();        

    });

</script>