0

I'm trying to debug a contact form that was built in Flash, but I'm not sure how I can go about debugging this. From the ActionScript, I can tell that it's supposed to POST the results to /assets/files/functions.php. The problem is that when I fill out the fields and click onto 'Send' (which is supposed to trigger this), nothing happens and I can't tell if it's a PHP issue or a flash issue.

Is there any ideas as to how to debug this?

The website can be found here and the form can be seen by clicking onto 'Connect' and then click onto 'Send Inquiry'.

The code may be seen below:

lvOut = new LoadVars();               //create lv object  
lvIn = new LoadVars();                //create lv object
lvIn.onLoad = function (success) {
if(success){
    gotoAndPlay("success");
}else{
    gotoAndPlay("failure");
}
}

function submit() {
if ( (inputName.text != "") && (inputAddress.text != "") && (inputCity.text != "") && (inputState.text != "") 
      && (inputCountry.text != "") && (inputTelephone.text != "") && (inputEmail.text != "") ) {
        lvOut.input_name = inputName.text;
        lvOut.input_address = inputAddress.text;
        lvOut.input_city = inputCity.text;
        lvOut.input_state = inputState.text;
        lvOut.input_zip = inputZip.text;
        lvOut.input_country = inputCountry.text;
        lvOut.input_telephone = inputTelephone.text;
        lvOut.input_email = inputEmail.text;
        lvOut.input_bedrooms = inputBedrooms.text;
        lvOut.input_realtor = inputRealtor.text;
        lvOut.input_comments = inputComments.text;

        if (realtorYes) {
            lvOut.input_hasRealtor = "yes";
        } else if (realtorNo) {
            lvOut.input_hasRealtor = "no";
        } else {
            lvOut.input_hasRealtor = "no answer";
        }       

        //send vars to functions page and load in result 
        lvOut.sendAndLoad("assets/files/functions.php", lvIn, "POST"); 
}
}

btnSend.addEventListener("click", submit);

Please help me out as much as possible! :-)

4

3 に答える 3

0

URLLoaderクラスを使用して、別のアプローチを試してください。functions.php ファイルがオンラインのどこかにあると思います。

const SITE_DOMAIN:String = "PUT_YOUR_SITE_DOMAIN_HERE_UP_TO_ASSETS_FOLDER";
var loader = new URLLoader();
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
loader.addEventListener(Event.COMPLETE, loadCompleteHandler);

request = new URLRequest();
request.url = SITE_DOMAIN + "assets/files/functions.php";
request.method = URLRequestMethod.POST;
loader.load(request);

function loadCompleteHandler(event:Event):void
{
    // handle load complete
}

function securityErrorHandler(event:SecurityErrorEvent):void
{
    // handle security error
}

function ioErrorHandler(event:IOErrorEvent):void
{
    // handle io error
}

この助けを願っています。

于 2013-03-29T11:41:28.523 に答える
0

PHP スクリプトにエラーがあります: http://nordicacondos.com/assets/files/functions.php 修正してから、AS コードをトレースして、何が PHP に送信されるかを確認してください。

  1. 内部にトレースを追加して、空でない値のテストが機能するかどうかを確認します(すべてのフィールドが入力されていても、swf は何も送信しないため、問題はここにあると思います)
  2. 送信前に lvOut オブジェクトの内容を確認してください。AS2 では、次のように内容を参照できます。
for (var name in lvOut) {
  trace(name +'->' + lvOut[name]);
}

Flash IDE からテストできるように、PHP スクリプトにフル パスを追加します。

  1. lvIn onLoad ハンドラにトレースを追加して、起動したかどうかを確認します

次のように生のリクエストをログに記録して、PHP 側で確認することもできます。

$handle = fopen('log.txt', 'ab+');
fwrite($handle, print_r($_REQUEST, true) );
fwrite($handle, PHP_EOL);
fclose($handle);

functions.php ディレクトリに対する書き込み権限があることを確認してください。

もちろん、AS3 を使用すると、より適切に制御できます... :)

于 2013-03-30T11:41:03.280 に答える
0

Flash アプリに問題があります。何も送信しません。あなたが言ったウェブページをChromeで入力し、「開発者ツール」メニューの「ネットワーク」タブを開きました。「送信」ボタンのクリックで0件のリクエストをキャプチャしました。AS2(saveAndLoadはAS2方式)を知らないので何がいけないのかわかりませんが AS3でのPOSTリクエストの動作例を以下に示します。

于 2013-03-29T11:28:26.960 に答える