Jump to content

Archived

This topic is now archived and is closed to further replies.

ShaolinF

wordpress: Admin Form plugin not POSTing

Recommended Posts

Hi Guys

 

I am working on a form plugin for my admin section. I written a simple form but everytime I try submit it the input values are not POSTed. I don't know if its my setup or something wrong with the code. I am using WAMPSERVER 2.0 - Below is my code:

 

<?php
/*
Plugin Name: My First plugin
Plugin URI: -
Description: -
Author: -
Author URI: -
*/

function printNewCoursePage() {
if( isset($POST['stage']) && ('process' == $_POST['stage']) )
{
	/*Course Title*/
	if($POST['course_title'] != "")
	{
                    echo "form submitted";
	}
}
else {
	echo "form not submitted";
}
?>
<!-- HTML BEGIN -->
<div class="wrap">
	<h2>Add New Course</h2>
	<form name="new_course_form" method="POST" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
		<input type="hidden" name="course_form" id="course_form" />

		<!-- Course Details Start -->
		<div class="postbox">
			<h3 class="handletxt">Course Details</h3>

			<!-- Course Title -->
			<div class="insidebox">
				<div class="form_text">Course Title:</div>
				<input type="text" class="txtbox" name="course_title" value="<?php echo $course_title; ?>" id="course_title" />
			</div>
			<input type="hidden" name="stage" value="process" />
		<div class="postbox">
			<h3 class="handletxt">Publish</h3>
			<div id="major-publishing-actions">
				<input id="publish" class="button-primary" type="submit" value="Publish Course" name="submit"/>
			</div>
		</div>
	</form>
</div>
<!-- HTML END -->
<?php	

}

function addNewCourse() {
add_menu_page(
	'Courses',
	'Manage Courses',
	'administrator',
	'newcourse',
	'printNewCoursePage'
);
}

add_action('admin_menu', 'addNewCourse');

?>

Share this post


Link to post
Share on other sites

this might be the problem

 

if( isset($POST['stage']) && ('process' == $_POST['stage'])

 

you have $POST

 

Probably should be $_POST

 

Let me know

 

Thanks

 

James

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.