Admin Form plugin not POSTing
-
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'] != "") { $course_title = filter_var($_POST['course_title'], FILTER_SANITIZE_STRING); if(trim($course_title) == "") { $errors['course_title'] = "Please enter a valid title" ; } } } 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'); ?>
The topic ‘Admin Form plugin not POSTing’ is closed to new replies.