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/
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:
<?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)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘admin-post.php issue form submission’ is closed to new replies.