Agradeceria ajuda para remover mascara telefone e persistir no bd.
<div class="form-group col-md-4">
<label for="inputTelefone">Telefone</label>
<input type="text" placeholder="numero"
class="form-control" name="telefone" id="phone" placeholder="só numeros" onkeypress="mask(this, mphone);" onblur="mask(this, mphone);">
</div>
<script type="text/javascript">
function mask(o, f) {
setTimeout(function() {
var v = mphone(o.value);
if (v != o.value) {
o.value = v;
}
}, 1);
}
function mphone(v) {
var r = v.replace(/\D/g, "");
r = r.replace(/^0/, "");
if (r.length > 10) {
r = r.replace(/^(\d\d)(\d{5})(\d{4}).*/, "($1) $2-$3");
} else if (r.length > 5) {
r = r.replace(/^(\d\d)(\d{4})(\d{0,4}).*/, "($1) $2-$3");
} else if (r.length > 2) {
r = r.replace(/^(\d\d)(\d{0,5})/, "($1) $2");
} else {
r = r.replace(/^(\d*)/, "($1");
}
return r;
}
</script>
segue cliente.php
public function getTelefone()
{
return $this->telefone;
}
public function setTelefone($telefone)
{
$this->telefone = $telefone;
}