skip to Main Content

Hello i need to add a link in the following code to redirect the (submit button)
Here the code

<form class="checkout adq-billing" enctype="multipart/form-data" action="<?php echo StaticAdqQuoteRequest::get_quote_list_link() ?>" method="post" name="checkout">
                <div class="col2-set">

            <?php 
                    //Billing/Account information
                    //, 'is_billing_filled' => $is_billing_filled
                    adq_get_template( 'adq-form-billing-details.php', array( 'checkout' => StaticAdqQuoteRequest::get_checkout() ) );
                    
                    ?>


                    <div class="col-2">
            
            <?php
                    //Force enabled to avoid core Woocommerce system
                    $shipping->enabled = StaticAdqQuoteRequest::is_shipping_enabled();
                    //Get Shipping options and address
                    $shipping->calculate_shipping( WC_Adq()->quote->get_shipping_packages() );
                    $packages = $shipping->get_packages();

                    if ( $shipping->enabled ) :

                        if ( get_option( 'adq_enable_shipping' ) == "user" ) : ?>
                            <label for="include-shipping-cost">
                                <?php _e( 'Would you want to include the shipping cost in quotation?', 'woocommerce-quotation' ); ?> <input id="include-shipping-cost" type="checkbox" name="include-shipping-cost" value="1" checked />
                            </label>
                        <?php endif;
                    
                        if ( get_option( 'woocommerce_ship_to_destination' ) != "billing_only" ) :
                            
                            adq_get_template( 'adq-form-shipping.php', array( 'checkout' => WC()->checkout() ) );
                                                 
                        endif;

                        echo '<div class="adq-shipping">';                     
                        foreach ( $packages as $i => $package ) {
                            $chosen_method = isset( WC()->session->chosen_shipping_methods[ $i ] ) ? WC()->session->chosen_shipping_methods[ $i ] : '';
                            adq_get_template( 'adq-cart-shipping.php', array( 'package' => $package, 'available_methods' => $package['rates'], 'show_package_details' => ( sizeof( $packages ) > 1 ), 'index' => $i, 'chosen_method' => $chosen_method ) );

                        };
                        echo '</div>';
                        
                    endif;
            ?>

                    <p id="quote_comments_field" class="form-row notes woocommerce-validated">
                            <label class="" for="order_comments"><?php echo __('Message','woocommerce-quotation') ?></label>
                            <textarea cols="5" rows="2" placeholder="<?php echo __('Please Any other requirements.','woocommerce-quotation') ?>" id="order_comments" class="input-text" name="order_comments" required></textarea>
                    </p>
                    </div>

                </div>

                <?php if ( wc_get_page_id( 'terms' ) > 0 && apply_filters( 'adq_checkout_show_terms', true ) ) : ?>
                        <p class="form-row terms">
                                <label for="terms" class="checkbox"><?php printf( __( 'I&rsquo;ve read and accept the <a href="%s" target="_blank">terms &amp; conditions</a>', 'woocommerce-quotation' ), esc_url( get_permalink( wc_get_page_id( 'terms' ) ) ) ); ?></label>
                                <input type="checkbox" class="input-checkbox" name="terms" <?php checked( apply_filters( 'woocommerce_terms_is_checked_default', isset( $_POST['terms'] ) ), true ); ?> id="terms" />
                        </p>
                <?php endif; ?>                    
                
                <input type="submit" data-value="<?php echo __('Submit Quote Request','woocommerce-quotation') ?>" value="<?php echo __('Submit','woocommerce-quotation') ?>" id="quote_place_order" name="adq_quote_place_order" class="button alt">  

                <a class="button wc-backward return-to-shop" href="http://localhost/test"><?php _e( 'Go Back', 'woocommerce-quotation' ) ?></a>

                    <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('woocommerce-process_checkout'); ?>">
            </form>

#############################################################
I have added a link and it works but the form was not submitted, is there’s any way to submit a form with url redirection, view code

2

Answers


  1. The tag <input type="submit" /> is used to submit a form.

    You will find that this INPUT is inside a <form action=""> tag. action="" is the path the form will be submit to.

    If you don’t need to submit the form, simply use a tag <a></a>.

    <a href="#your-link.php" id="quote_place_order" name="adq_quote_place_order" class="button alt">
        <?php echo __('Submit','woocommerce-quotation') ?>
    </a>
    
    Login or Signup to reply.
  2. You need a Form tag so you could add an action attribute to that. Now by clicking the submit button your form will be redirected to the URL that u assigned to the form.

    <form action="site.com">
        <input type="submit">
    </form>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search