Tuesday 21 August 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...