![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 1 Pomógł: 0 Dołączył: 7.07.2012 Ostrzeżenie: (0%) ![]() ![]() |
Witam serdecznie
Jako ze dopiero zaczynam zabawę z WWW, php itd. Natrafiłem na pewien problem z którym nie potrafię sobie poradzić. a mianowicie jest to wysłanie maila ze strony flash AS3. Ogólnie mail się wysyła ale chciał bym dodać opcje sprawdzenia w php czy dane pola są uzupełnione w formularzu, z tego wzgledu ze mozna wysywal pusta wiadomosc :/. Kombinuje na rożne sposoby ale nie bardzo mi to wychodzi. Poniżej dodam dok AC3 jak również php. Kod AS3 Kod package main.strona.controlers { import mx.controls.Alert; import mx.managers.CursorManager; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.http.HTTPService; import spark.components.TextInput; public class ContactController { [Bindable] public var imie:TextInput; [Bindable] public var nazwisko:TextInput; [Bindable] public var email:TextInput; [Bindable] public var temat:TextInput; [Bindable] public var wiadomosc:TextInput; private var _contactService:HTTPService; public function ContactController() { } public function sendEmail():void { CursorManager.setBusyCursor(); disableForm(false); _contactService = new HTTPService(); _contactService.url = "http://******.pl/php/emaila.php"; _contactService.resultFormat = "text"; _contactService.method = "POST"; _contactService.addEventListener(ResultEvent.RESULT, onResultSendEmailData); _contactService.addEventListener(FaultEvent.FAULT, onFault); var obj:Object = new Object(); obj["verify"] = "******.098"; obj["imie"] = imie.text; obj["nazwisko"] = nazwisko.text; obj["mail"] = email.text; obj["temat"] = temat.text; obj["wiadomosc"] = wiadomosc.text; _contactService.send(obj); } private function onResultSendEmailData(event:ResultEvent):void { var obj:Object = event.result; if (obj) { var isEmailSent:Boolean = String(obj) == "ok" ? true : false; if (isEmailSent) { var mainApp:Main = imie.parentApplication as Main; mainApp.currentState = "Wyslany_email"; } } disableForm(true); CursorManager.removeBusyCursor(); } private function onFault(event:FaultEvent):void { Alert.show("Nie udało się wysłać wiadomości"); disableForm(true); CursorManager.removeBusyCursor(); } public function disableForm(isDisabled:Boolean):void { imie.enabled = isDisabled; imie.alpha = isDisabled ? 1 : 0.5; nazwisko.enabled = isDisabled; nazwisko.alpha = isDisabled ? 1 : 0.5; temat.enabled = isDisabled; temat.alpha = isDisabled ? 1 : 0.5; email.enabled = isDisabled; email.alpha = isDisabled ? 1 : 0.5; wiadomosc.enabled = isDisabled; wiadomosc.alpha = isDisabled ? 1 : 0.5; } } } kod PHP
|
|
|
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 108 Pomógł: 5 Dołączył: 8.12.2011 Skąd: Łomża Ostrzeżenie: (0%) ![]() ![]() |
If i funkcja empty.
-------------------- if($problem == 1)
{ header("Location: http://www.forum.php.pl"); } else { thinking(); } |
|
|
![]()
Post
#3
|
|
![]() Grupa: Zarejestrowani Postów: 1 707 Pomógł: 266 Dołączył: 3.07.2012 Skąd: Poznań Ostrzeżenie: (0%) ![]() ![]() |
Żadne empty!
|
|
|
![]()
Post
#4
|
|
Grupa: Zarejestrowani Postów: 1 447 Pomógł: 191 Dołączył: 26.03.2008 Ostrzeżenie: (0%) ![]() ![]() |
masz coś do funkcji empty ?
![]() -------------------- :)
|
|
|
![]()
Post
#5
|
|
![]() Grupa: Zarejestrowani Postów: 1 707 Pomógł: 266 Dołączył: 3.07.2012 Skąd: Poznań Ostrzeżenie: (0%) ![]() ![]() |
Tak, jej zachowanie dotyczące łańcuchów znaków jest idiotyczne. Dlaczego po wpisaniu w pole tekstowe "0" mamy otrzymywać informację o braku wpisania czegokolwiek?!
|
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 19.07.2025 - 04:38 |