php - Place a default email address in when a custom form field is left blank -


i want place default email address in when custom form field left blank. can't code right. use email address in place of real email address.

<?php if(get_field('cemail')) { ?>  <?php $email =  (get_field('cemail')); if($email!=""){ echo 'email address' ; } ?>  

you can like;

<?php  $email = $_get["email"]; if($email=="" || !filter_var($email, filter_validate_email) === false)   $email = "default_email@email.com";  echo $email; ?> 

Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -