Need help with code to submit form directly to me


#1

I need to send an email with this in the body and have the recipient submit directly to me without opening an email client or new email window. Any help is appreciated.

Thank you

	<form method="post" action=action="form-to-email.php">
  <div class="ax-border name ">
    <input type="text" id="name" class="si-text-field form-textbox " placeholder="Full name">
</div>
    </label>
    <div class="ax-border phone ">
      <input type="text" id="phone"   form-textbox"
        placeholder="Phone number"> 
	<input type="submit" value="Submit"/> 
      </form>
<?php$to="ryanmandree@gmail.com";?>

#2
<form method="post" action=action="form-to-email.php">
  <div class="ax-border name ">
    <input type="text" id="name" class="si-text-field form-textbox " placeholder="Full name">
  </div>
    </label>
  <div class="ax-border phone ">
    <input type="text" id="phone"   form-textbox" placeholder="Phone number"> 
    <input type="submit" value="Submit"/> 
</form>
<?php$to="ryanmandree@gmail.com";?>

So you’d agree that, as it is, it’s not doing anything.

<?php$to="ryanmandree@gmail.com";?>
this serves no purpose. It won’t just work like that.

<form method="post" action=action="form-to-email.php">
this is not correct. action=action is not correct.

The whole logic behind this simple HTML form lives within form-to-email.php.
That file takes care of sanitizing the data, and sending the email.
And you haven’t provided that.

So, as it is, there’s nothing we can do I’m afraid…


In addition,

What is </label> doing there all on its own, and you didn’t close the second <div>


#3

Thank you, so what other changes or additions do I need to make in order to have it work properly? Just the changes you mentioned?


#4

If you implement the changes suggest by @ghostlovescore and your form-to-email.php contains the right code, it should work. See the PHP manual if you need to know more abuot mail:

http://php.net/manual/en/function.mail.php