Jump to content

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

?>

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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