Announcement

Collapse
No announcement yet.

if and else

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • if and else

    hy, i use this script and works, if user not have a emai print a message, and if user have a email print a message and send email, but want insert another else that if a field {message} not have value want block script and not send email.
    // Send email";

    if($email == ''){


    print("Il cliente non ha una email!!!");

    }





    else {
    print('Email inviata');





    sc_mail_send($mail_smtp_server,
    $mail_smtp_user,
    $mail_smtp_pass,
    $mail_from,
    $mail_to,
    $mail_subject,
    $mail_message,
    $mail_format);

    }

  • #2
    You can do like this:
    if($email == ''){

    echo"Il cliente non ha una email!!!";

    }elseif(empty({message})){
    echo "The message is empty";
    }

    else {
    echo "Email inviata";

    sc_mail_send($mail_smtp_server,
    $mail_smtp_user,
    $mail_smtp_pass,
    $mail_from,
    $mail_to,
    $mail_subject,
    $mail_message,
    $mail_format);

    }

    Comment


    • #3
      ok,i use:
      // Send email";

      if($email == ''){


      print("Il cliente non ha una email!!!");

      }

      elseif({testo_email} == '') {
      print("Non e' presente nessun messaggio per le email");
      }




      else {
      print('Email inviata');





      sc_mail_send($mail_smtp_server,
      $mail_smtp_user,
      $mail_smtp_pass,
      $mail_from,
      $mail_to,
      $mail_subject,
      $mail_message,
      $mail_format);

      }

      Comment

      Working...
      X