ADJOURNMENT
I'm sorry for delay in the response but another project had priority. I followed the dimitry advice and added the ajax call. Front-end validation with validated jquery and jquery form for sending ajax.
I state that the management of the pages of the site is entrusted to a php switch.
If the form is ok it should go to thanks.php with simple custom message (hello NAME, .... MAIL) and call form-validation.php which executes phpMailer. I can go to thanks.php with window.location.href but the data does not pass to the php page and I don't know how to call two different pages.
HTML CODE (Essential)
<form method="post" action="thanks" id="form_contatti" class="contact100-form" autocomplete="on">
<div class="form-group col-lg-12">
<input type="text" name="name" class="form-control" placeholder="Name*" autofocus value="" required>
</div>
<div class="form-group col-lg-12">
<input type="text" name="surname" class="form-control" placeholder="S*" autofocus valueurname="" required>
</div>
<div id="Pulsante" class="text-center">
<!-- Generated With Jquery on page ready -->
</div>
</form>
Validation Code
submitHandler: function(form) {
$.ajax({
url: 'form_validation.php',
type: $(form).attr('method'),
data: $(form).serialize(),
cache: false,//On dev disable cache. Remove on production
success: function(response) {
alert("Thank you for your comment!");
window.location.href = $(form).attr('action');
}
});
}
I tried to make the call synchronous, to insert both calls in get and then in post, to insert the second ajax in the first but nothing.
I'm use phpmailer to send data from the form, unfortunately I also have to send two files (cv and cover letter) and this slows it down a lot (it takes more than 5 seconds to load the page).
Aruba Server,
HTTPS,
NO DATABASE
Windows Hosting,
Php 7.2 available
Uses an auto@domainname.ext to have the email sent from the address entered in the form.
I have no direct access (neither to the server nor to the aruba administration panel), therefore I cannot install / modify / configure / enable anything.
Is there a way to make sending asynchronous or something?
I have looked at other answers here but they are not for me because they plan to install libraries or change settings.
If needed I can attach a server's info.php screen.
I have little php experience and I don't know object-oriented programming so it's all more difficult.
Thank you very much.