Title: admin-post.php issue form submission
Last modified: September 5, 2023

---

# admin-post.php issue form submission

 *  anonymized-5761652
 * (@anonymized-5761652)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/admin-post-php-issue-form-submission/)
 * I have a form on a WordPress site that also adds a record to mysql database.
 * The issue is that the form does not go to where it is suppose to: [https://wordpresssite/get-form/](https://wordpresssite/get-form/)
 * If if submit the form as administrator the form works. Submitting the form as
   a subscriber does not work. It just redirects to the subscribers home page.
 * Here is the form code:
 *     ```wp-block-code
       <?php if(isset($_GET['success'])): 
       echo "<script>window.location='https://website/get-form/'</script>";?>
       <?php endif; ?>
   
       <?php if(isset($_GET['error'])): ?>
           <div class="alert alert-danger">
               <h3>Sorry! Unable to submit the form.</h3>
           </div>
       <?php endif; ?>
   
       <form name="order_form" method="POST" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" enctype="multipart/form-data" autocomplete="off" accept-charset="utf-8">
       <?php if(isset($_GET['success'])): 
           echo "<script>window.location='https://smilepix.com/sp_client/get-form/'</script>";?>
       <?php endif; ?>
   
       <?php if(isset($_GET['error'])): ?>
           <div class="alert alert-danger">
               <h3>Sorry! Unable to submit the form.</h3>
           </div>
       <?php endif; ?>
   
       <form name="order_form" method="POST" action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" enctype="multipart/form-data" autocomplete="off" accept-charset="utf-8">
       ```
   
 * A few weeks ago everything worked fine. I turned off all the plugins, but the
   issue is still there.
 * Thanks for your help.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/admin-post-php-issue-form-submission/#post-17028313)
 * > I have a form on a WordPress site that also adds a record to mysql database
 * Are you using a plugin for this form? If yes, what plugin? Acquired from?
 * Or is it a feature of your theme? If yes, what theme? Acquired from?
 *  Thread Starter anonymized-5761652
 * (@anonymized-5761652)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/admin-post-php-issue-form-submission/#post-17030858)
 * No I am not using a plugin for this. I found the solution on the internet and
   it requires putting the some code in the functions.php. I would be interested
   in a plugin that does this. What plugin are you using.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘admin-post.php issue form submission’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 2 replies
 * 2 participants
 * Last reply from: anonymized-5761652
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/admin-post-php-issue-form-submission/#post-17030858)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
