$_post variables inside a plugin
-
Hey everyone, I’m building a simple plugin that displays a form, and then posts the data back to itself for processing. But it seems that nothing ever gets posted, the post variables are always empty. When I just put the code inside a template, though, it works fine.
Is there something that disables my $_POST variables if I run it through a filter? Maybe I am missing something.
Thanks, here’s some code if it helps:
function spurl($content) {
global $wp_query;
$post_ID = $wp_query->post->ID;if($post_ID == 121) {
$id = $_GET['id'];if(!isset($id)) {
$content = '';
$content .= '<form id="demoform" action="' . get_bloginfo ( 'url' ) . '?page_id=' . $post_ID . '" method="post">';$content .= '<input type="text" name="first" value="fist" />';
$content .= '<p><input type="submit" name="submit" value="SUBMIT" /></p>';
$content .= '</form>';
if (isset($_POST['submit'])) {
header('Location: http://www.google.com/');
}
}
}
return $content;
}
add_filter ( 'the_content', 'spurl' );
The topic ‘$_post variables inside a plugin’ is closed to new replies.