Jump to content

Wordpress plugin form not submitting


ShaolinF

Recommended Posts

Hey Guys

I have been working on a wordpress plugin. I am extending the admin section to add a form whereby the admin can add new courses. The problem is the damn form doesn't POST the data. Can someone please take a look at it and tell me where Im going wrong ?

 

function printNewCoursePage() {
if( isset($POST['stage']) && ('process' == $_POST['stage']) ) 
{
	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="stage" value="process" />

		<!-- 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>

		<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');

Link to comment
https://forums.phpfreaks.com/topic/182463-wordpress-plugin-form-not-submitting/
Share on other sites

Archived

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

×
×
  • 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.