PHP newbie here trying to use a simple contact form. The fields I have are: "Name", "Email", "Phone", and "Message". I am trying to figure out what to do with the "Phone" field – I want it to output to the same place that "Message" does, so that when the email is received it will output both the message and the phone number to the body of the email. How do I do this?
if( isset( $_POST['submit'] ) ) :
wp_mail( get_option( 'admin_email' ),
'Website Contact Form',
( isset($_POST['message'] ) ? $_POST['message'] : '(blank)' ),
'From: ' . ( isset( $_POST['from_name'] ) ? $_POST['from_name'] : 'Website Contact Form' ) . ' <' . ( isset( $_POST['from_email'] ) ? $_POST['from_email'] : get_option( 'admin_email' ) ). '>' . "\r\n" );
$output = '<p>Thank you! Your message has been sent.</p>';
else :
$output = '
<form action="" method="post"><ul>
<li>
<label for="from_name">Name</label>
<input type="text" name="from_name" id="from_name" />
</li>
<li>
<label for="from_email">Email</label>
<input type="email" name="from_email" id="from_email" />
</li>
<li>
<label for="from_tel">Phone</label>
<input type="tel" name="from_tel" id="from_tel" />
</li>
<li>
<textarea name="message" id="message"></textarea>
</li>
<li class="submit">
<input name="submit" type="submit" value="Say Hello!" />
</li>
</ul></form>';
endif;
return $output;