Im trying to make a custom form and insert into the database but when I click submit nothing happens. Please help me. I did research and changed my code but still same result. I dont know why.

this is the code in my template named std:

Template Name: Student

<?php echo "google";?>



global $wpdb;



            'name' => $name,
            'roll' => $roll,
            'dept' => $dept
) == false) wp_die('Database insertion failed');
    else echo "Database insertion successful<p />";

else //else we didnt submit the form, so display the form
?><form action="" method="post" id="addcourse">

<label> Student Name:<input type="text" 
name="aname" size="30" /></label>

<label> Roll:<input type="text" 
name="aroll" size="30" /></label>

<label> Department:<input type="text" 
name="adept" size="30" /></label>


<input type="Submit" id="addcoursesubmit" value="submit" />


<?php get_sidebar(); ?>
<?php get_footer(); ?>

Read more here: WP create custom table and insert data in front end


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: