Hi guys: I hope that you will be in good health

I use the form below to enter data into the database in WordPress.

<form action="<?php echo admin_url('admin-post.php'); ?>" method="post">
    <input type="hidden" name="action" value="mhmd_volunteer_form_submitted">

    <input type="text" name="first_name" value="">
    <input type="text" name="last_name" value="">
    <input type="email" name="email" value="">

    <input type="submit" name="submit" value="add">



function mhmd_volunteer_form(){

   global $wpdb;
   $name1 = isset( $_POST['first_name'] ) ? $_POST['first_name'] : null;
   $name2 = isset( $_POST['last_name'] ) ? $_POST['last_name'] : null;
   $email = isset( $_POST['email'] ) ? $_POST['email'] : null;


   $rows_affected = $wpdb->insert( $my_table_name, array( 'first' => $name1, 'last' => $name2, 'email' => $email) );

    add_action( 'admin_post_mhmd_volunteer_form_submitted', 'mhmd_volunteer_form' );

My question is: How do I retrieve data in the admin panel as a table, such as comments. I do not want to add any plugins, and thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.