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