i am trying to build a wordpress plugin that will allow the admin to create user from the admin page after creating the form and the process php code, i refresed my wordpress but no error but then after filling the form and click on the register button it is showing me page not found and the i have placed the classifiedbr.php and demo.php on the same folder but it is still not working
this is my php code named classfiedbr.php
<?php
/**
* @package ClassifiedBr
*/
/*
Plugin Name: ClassifiedBr
Plugin URI: http://britchi.com/plugin
Description: This is my first Attempt on writting a custom plugin
Version: 1.0.0
Author: *Bright* C Godwin
Author URI: http://britchi.com/plugin
License: GPLv2 or later
Text Domain: classifiedbr-plugin
*/
add_action('admin_menu', 'classifiedbr_setup_menu');
function classifiedbr_setup_menu(){
add_menu_page( 'ClassifiedBr Page', 'ClassifiedBr', 'manage_options', 'classifiedbr', 'classifiedbr_init' );
}
function classifiedbr_init(){
echo '<form action="demo.php" method="post" />';
echo "<h1>Britchi Tracking</h1>";
echo '<p>';
echo 'Costumers Name (required) <br/>';
echo '<input type="text" name="cname"/>';
echo '</p>';
echo '<p>';
echo 'Tracking number (required) <br/>';
echo '<input type="text" name="ctracking"/>';
echo '</p>';
echo '<p>';
echo 'Email (required) <br/>';
echo '<input type="email" name="cemail" />';
echo '</p>';
echo '<p>';
echo 'Recived Port (required) <br/>';
echo '<input type="text" name="crport" />';
echo '</p>';
echo '<p>';
echo 'Delivered Port (required) <br/>';
echo '<input type="text" name="cdport" />';
echo '</p>';
echo '<p>';
echo 'Current Location (required) <br/>';
echo '<input type="text" name="clocation" />';
echo '</p>';
echo '<p>';
echo 'Destination (required) <br/>';
echo '<input type="text" name="cdestination". />';
echo '</p>';
echo '<p><input type="submit" name="cregistered" value="Register"></p>';
echo '</form>';
}
?>
then this is my demo.php
<?php
define('DB_NAME', 'class');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_selected_db(DB_NAME, $link);
if (!$db_selected) {
die('Can\'t use ' . DB_NAME . ': ' . mysql_error());
}
$cname = $_POST['cname'];
$cemail = $_POST['cemail'];
$ctracking = $_POST['ctracking'];
$crport = $_POST['crport'];
$cdport = $_POST['cdport'];
$cname = $_POST['clocation'];
$cname = $_POST['cdestination'];
$sql = "INSERT INTO demo (cname, cemail, ctracking, erport, cdport, clocation, cdestination) VALUES ('$cname', 'cemail', 'ctracking', 'crport', 'cdport', 'clocation', 'cdestination')";
if (!mysql_query($sql)) {
die('ERROR: ' . mysql_error());
}
mysql_close();
?>
this is the page
this is the error massage i get from the page
this is the folder where i saved the files
i have tried searching here but the question that is related to my own problem (my php form not insert to phpmyadmin) but it is not yet solved so i am hoping someone can help me out thanks