Tuesday, August 21, 2018

php - How to use input type="tel" in a contact form

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 = '

Thank you! Your message has been sent.

';

else :
$output = '





















';
endif;
return $output;

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...