简体   繁体   中英

Submitting a Form in Wordpress/Woocommerce admin order details

im trying to submit a form in order details if the order is processing. I have the button and field appearing and shows when the order is in processing. but when I submit it does nothing. im very sure im not got it right this is inside of a plugin. all the variables are there and work and display on the order page. so im only stuck on why when I press submit it does nothing at all.

 <?php if ($order_status1 == 'processing'){ //echo'<p><input type="text" name="sadd" id="sadd"><a href="?post=';echo $post_id;echo'&action=edit&abc=';echo $value;echo'" class="button">';echo"Add S to Order";echo'</a></p>'; echo'<form action="#" method="post" id="astof" onSubmit="return confirm(';echo"'message that will display before submission?'";echo');"> <input class="woocommerce-Input woocommerce-Input--text input-text" type="text" name="sadd1"> <button type="submit" class="woocommerce-button button woocommerce-form-login__submit" form="astof" value="changes1" name="asto">Add Order</button> </form>'; }?> <?php if(isset($_POST['astof'])){ $resultsn = $_POST['sadd1']; $wpdb_dbconnectp = new wpdb('user', 'pass', 'Dan', 'localhost:3306'); $wpdb_dbconnectp->show_errors(); $sobject = $wpdb_dbconnectp->get_col("SELECT msisdn FROM s_stock WHERE idd = '$resultsn'"); foreach ($sobject as $sneeded) $scutnoplus = substr($sneeded, 1); update_meta_data( $oiid, '_snumber', $resultsn ); update_post_meta( $gsn, '_snumber', $resultsn ); update_post_meta( $gsn, '_s', $scutnoplus ); }?>

Try manually adding the action attribute to your form instead of #. It seems that the button does not do it on its own.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM