why don’t you use a shortcode? add the shortcode in the content of that page and then create a function to show that form and include the php file.
the user with id 1 is always the super user/admin. I’m not sure but maybe there is a strict validation for other users when adding content to a post (this is just a guess). But using a shortcode should be no problem at all.
so you should end up with:
(you should add an attribute for every variable, I don’t added all of them i think)
$my_post = array(
'post_title' => 'My bet',
'post_content' => '[showform event="' . $_POST[event] . '" amount="' . $_POST[amount] . '" bet_id="' . $bet_id . '"][showform]',
'post_status' => 'publish');
Somewhere else in your code you would add:
add_shortcode('showform', 'showForm');
function showForm() {
extract( shortcode_atts( array(
'event' => 'default event',
'amount' => 20,//default amount
'bet_id' => 0
), $atts ) );
echo '<form action="" method="post" id=form_id>' . 'bet ID: ' . '<input readonly id=betid type=text value=" . $bet_id . ">' . '<input id=url name=urlpath type=hidden value=>' . '</form>' ."\r\n match: " . '<span id=match>' . $event . '</span>' . "\r\n" . $current_user->user_login . "'s Pick: " . $_POST[bet] . '</span>' . '<span id=friends>' . '</span>' ."\r\n Amount: " . '<span id=amount>' . $amount . '</span>';
include('wp-content/themes/twentyfourteen/test.php');
}
if you added the shortcode function in the functions.php of your theme you should just do:
include('test.php');