i have created a payment plugin in woocommerce- i have a custom form with fields. ID number is the field i am wanting to retrieve in the PHP function.
i have a send OTP button this button post to an external API. everything works all i need to do is pass the value in the textbox to a php method.
ive tried assigning the javascript variable to a php variable i tried using
$POST['textboxID'], i also tried using $GET['textboxID']
public function payment_fields()
{
if ($this->description) {
echo wpautop(wp_kses_post($this->description));
}
do_action('woocommerce_credit_card_form_start', $this->id);
// add_action('woocommerce_after_order_notes','idNumber');
$float = WC_Payment_Gateway::get_order_total();
$grandTotal = number_format((float)$float, 2, '.', '');
$username = $this->get_option('publishable_key');
$password = $this->get_option('private_key');
echo '<div id="custom_input" class="form-row form-row-wide">
<form method="post" name="myform">
<table>
<tr>
<td>
<label >ID Number : <span class="required">*</span></label>
</td>
<td>
<input id="idNumber" name="idNumber" type="text" value="" style="width:224px;margin:-30px -59px" autocomplete="off">
public function process_payment($order_id,$CardOrIDNumber)
{
global $woocommerce;
$order = new WC_Order($order_id);
$float = WC_Payment_Gateway::get_order_total();
$data3 = openssl_random_pseudo_bytes(16);
$data3[6] = chr(ord($data3[6]) & 0x0f | 0x40); // set version to 0100
$data3[8] = chr(ord($data3[8]) & 0x3f | 0x80); // set bits 6-7 to 10
$GUID = vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data3), 4));
$idNumber = $GET['idNumber'];
print_r($idNumber);
i just need to pass that form id input 'idNumber' value to the process payment method.
all this code is in the same file.