Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] zdefiniowanie zmiennej, definiowanie zmiennej
--adamus--
post
Post #1





Goście







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");
?>
Go to the top of the page
+Quote Post
Turson
post
Post #2





Grupa: Zarejestrowani
Postów: 4 291
Pomógł: 829
Dołączył: 14.02.2009
Skąd: łódź

Ostrzeżenie: (0%)
-----


Wstawiaj kod w odpowiednie znaczniki.

Co to za problem.
if($liczbapunktow>od iluś tam) to $wynik = "zdałeś" jeśli nie $wynik="nie zdałeś"
Potem w treści wiadomości wstawiasz $wynik
Go to the top of the page
+Quote Post
--adamus--
post
Post #3





Goście







Dzięki, ok. Tak mniej więcej sobie wyobrażam taką funkcję. Ale czy to nie problem, że cała treść maila jest już w zmiennej $beseked, więc muszę zdefiniować dwie zmienne, i tak jak mówisz mogą to być $wynik1 i $wynik2 ale te zmienne będą już wewnątrz $besked i nie wiem jak tu zadziałać.
Ad
Go to the top of the page
+Quote Post
Turson
post
Post #4





Grupa: Zarejestrowani
Postów: 4 291
Pomógł: 829
Dołączył: 14.02.2009
Skąd: łódź

Ostrzeżenie: (0%)
-----


Najpierw sprawdźczy osoba zdała i zdefiniuj odpowiednie zmienne. Najlepiej jedną na 2 sposoby, inaczej będziesz miał problem, że zmienna nie istnieje.
Potem dodaj do $besked zmienną z informacją o zdaniu/nie zdaniu.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 11:08