Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Post selected option value in HTML

I have a list of addresses for a shipping module. Once selected they should be saved using (POST) as a text comment $option. This used to work but after rewriting some of the function POST doesn't work. What is wrong here?

public function options($items, $subtotal, $tax, $currency_code, $customer) {

$vars = explode(';', $this->settings['addresses']);
$options = '';

foreach ($vars as $row)
{
$options .= '<option value="' . $row . '" >' . $row . '</option>' . PHP_EOL;
}

$fileds = '<select name="address" class="form-control">' . PHP_EOL . $options . '</select>';

return array(
    'title' => $this->name,
    'options' => array(
        array(
            'id' => 'option_1',
            'icon' => $this->settings['icon'],
            'name' => 'option 1',
            'description' => '',
            'fields' => $fileds,
            'cost' => $this->settings['fee'],
        ),
    ),
);
}

public function after_process($order)
{       
    $option = $_POST['address'];

    $order->data['comments'][] = array(
        'text' => $this->name . ': ' . $option,
    );

    $order->save();
}

EDIT: to be clear, I cant post data from <select><option>

Comments