If I understand your code, you want to send parameters to an external link at the same time you post form data to the internal page Whatsapp.php. You can try this with jquery, first access the link, and if you get a return, post the form. Here’s an example:
<script
src="https://code.jquery.com/jquery-3.4.0.min.js"
integrity="sha256-BJeo0qm959uMBGb65z40ejJYGSgR7REI4+CW1fNKwOg="
crossorigin="anonymous"></script>
<form action="whatsapp.php" id="send-whatsapp" target="_blank" method="POST">
<input name="login" id="login" type="hidden" value="logindousuario">
<input name="numero" id="numero" type="hidden" value="numero">
<input type="text" id="nome" name="nome" placeholder="Nome">
<input type="text" id="telefone" name="telefone" class="telephoneMask" placeholder="(00) 0000-0000">
<input type="button" onclick="enviarFormulario()">
</form>
<script type="text/javascript">
function enviarFormulario(){
var dados = {
login: $("#login").val(),
numero: $("#numero").val(),
nome: $("#nome").val(),
telefone: $("#telefone").val()
};
$.ajax({
url: 'https://site.com.br/whatsapp.php',
type: 'GET',
data: dados,
datatype: 'text'
})
.done(function (data) {
$("#send-whatsapp").submit();
})
.fail(function (jqXHR, textStatus, errorThrown) {
//Tratar o erro
});
}
</script>
Now, if your link is internal (I saw that the two pages share the same name), you can think of something simpler, send the form using the POST method and let the Whatsapp.php page read the data (using $_POST)
Does it have to be in onclick? You can take input values by placing a class or id. If you can, there is an answer that can help you at this link: https://answall.com/questions/21860/como-peg-input-usando-html-e-javascript
– Sabão