Sending a PHP form

Asked

Viewed 38 times

0

I own a form where the fields name="" has different values between [ ] because of an API I’m using. I was wondering how I can get this value from input to send to an e-mail?

<form id="msform" method="post" action="send.php" enctype="multipart/form-data">
 <input id="nome_completo" name="curriculo[nome_completo]" minlength="5" type="text" class="form-control" placeholder="Nome Completo*">
</form>    

1 answer

0

You can do it with Javascript and get value:

function getFormSubmitValues(formId){ 
     document.getElementById(formId).addEventListener('submit', function(e){
     e.preventDefault();
     const queryMyInput = document.querySelectorAll("#" + document.getElementById(formId).id + ' input');
		queryMyInput.forEach(function(n){
      //return n.value;
      console.log(n.value);
		});
	});
}

getFormSubmitValues('msform');
<form id="msform" method="post" action="send.php" enctype="multipart/form-data">
 <input id="nome_completo2" name="curriculo1[nome_completo]" minlength="5" type="text" class="form-control" placeholder="Nome Completo*">
 <button>Enviar</button>
</form>

After you get this value, you can maybe later, use Ajax to submit the form! If you don’t know how to use it, I can edit the answer later and explain it to you.

  • I managed to do with Ajax, but as I have an upload field I did not know how to send the form along with the email upload using $("#send"). click(Function(){

Browser other questions tagged

You are not signed in. Login or sign up in order to post.