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

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

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

asp.net mvc - breakpoint on javascript in CSHTML? -