• anonymized-5761652

    (@anonymized-5761652)


    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)
  • Moderator t-p

    (@t-p)

    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)

    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.