require('common.php');
require('html.php');
print_r($_POST);
$wallet_id = db_single_field('SELECT wallet_id FROM wallets WHERE wallet_id = ?', $_POST['wallet_id']);
if ($wallet_id) {
db_exec('DELETE FROM owners2wallets WHERE wallet_id = ?', $wallet_id);
if (is_array($_POST['owners'])) foreach ($_POST['owners'] as $owner_id) {
$safe_owner_id = db_single_field('SELECT owner_id FROM owners WHERE owner_id = ?', $owner_id);
if ($safe_owner_id) db_exec('INSERT INTO owners2wallets ( owner_id, wallet_id ) VALUES ( ?, ? )',
$owner_id, $wallet_id);
}
}
header('Location: owners2wallets.php?wallet_id='.$wallet_id);
?>