Witam wszystkich. Na wstępie mówię, że jestem zielony w PHP. Oto mój problem:
Mam skrypt, który wysyła maile do klientów, którzy robili test. Chciałbym, żeby w przypadku zaliczenia klient dostawał gratulacje, nie zaliczenia - wyrazy współczucia. O ile funkcję if else mogę sobie wyobrazić, to nie bardzo wiem jak zdefiniować zmienną z "gratulacjami" i "przykro nam nie zdałeś" W skrypcie poniżej cały ten tekst jest moim zdaniem w zmiennej $besked, która z kolei jest wwartością f. mail. Czy ktoś mógłby rozjaśnić sprawę? pozdrawiam
A oto skrypt:
<?php
$besked = "Email sent from the Administrator: \n
***************************************************************************
********* Project and access information *******
***************************************************************************
Dear " . utf8_decode($_POST['userID']). "
We regret to inform you that you have exceeded the number of attempts allowed to complete the " . utf8_decode($_POST['projectName']). ".
Administrator will contact you to arrange an alternative training assessment.
In addition, please ensure that you have completed the online user activation form in order to receive access to your trial database.Please note access details will only be issued
once your site has gone Live.
Kind regards,
If you have any questions regarding , please contact us.
Student name: " . utf8_decode($_POST['userID']). "
Project name: " . utf8_decode($_POST['projectName']). "
Contact number: " . $_POST['custom2']. "
Site: ". utf8_decode($_POST['custom1'])."
email address: ". utf8_decode($_POST['recipient'])."
Date completed: " . $_POST['dateCompleted']. "
Time completed: " . $_POST['timeCompleted']. "
Total time spent in course: " . $_POST['timeSpent']. "
***************************************************************************
********* Quizzing Information *******
***************************************************************************
Quiz score in percent: " . $_POST['quiz_user_quiz_percentage']. "
Total Points Scored: " . $_POST['quiz_user_scored_points']. "
Total Points Available: " . $_POST['quiz_total_available_points']. "
Points needed for a pass: " . $_POST['quiz_points_needed_for_a_pass']. "
Number of quiz attempts: " . $_POST['quizAttempts']. "
Total number of quiz questions: " . $_POST['quizQuestions']. "
Total number of correct answers: " . $_POST['quizCorrect']. "
Total number of unanswered questions: " . $_POST['quizUnanswered']."
";
if(isset($_POST['sendCustomVars']) && (strcasecmp($_POST['sendCustomVars'], 'true') == 0)) {
$besked .= "
**************************************************************************
********* Custom Variables *******
***************************************************************************
Custom variable 1: " . utf8_decode($_POST['custom1']). "
Custom variable 2: " . utf8_decode($_POST['custom2']);
}
// Do not edit anything below this line unless you know what you are doing..
// e-mail recipient
$recipient = utf8_decode($_POST['recipient']);
// e-mail subject
$subject = utf8_decode($_POST['subject']);
// e-mail sender
$sender = utf8_decode($_POST['email']);
// send e-mailen
mail($recipient, $subject, $besked, "From: $sender");
?>