メイン サーバ関連【CGI・FCS・XMLSocket etc】 Flash > PHP > PHP > Flash (全てPOSTで送信)で送った変数を表示させたい | 投稿するにはまず登録を |
フラット表示 | 前のトピック | 次のトピック |
投稿者 | スレッド |
---|---|
ichigo15 | Åê¹ÆNo.32633 投稿日時: 2007-3-25 19:37 |
新米 居住地: 投稿: 19
使用環境:
|
Flash > PHP > PHP > Flash (全てPOSTで送信)で送った変数を表示させたい こんばんわ。
質問をさせていただきますのでよろしくお願いいたします。 Flash > PHP > PHP > Flash 全てPOSTで送った変数を表示させたいのですが、 最後のFlashで「undefined」になってしまい、変数が取得できていない 状態です。 どのようにすれば、4)index.html+sample.swfにPHPから送られて来た 変数を読込めるのかご存じの方ご教授お願いします。 ブラウザで実行しています。 流れは以下です。 1)index.html (flashでパブリッシュしたhtml)+sample.swf btn1をクリックし「before = "flash to php";」をindex2.phpにPOSTで送信。 ここでの「strAfter」は「undefined」が表示される。(index3.phpに何も表示されていないので当たり前?) 2)index2.php 1)からPOSTで送信されてきた$_POST[before]は取得出来ている。 SQL接続をし、該当データを元に複数の<form action = "http://?>ボタンを作成し適宜のボタンをクリック。 送信する変数 //SQL接続等のスクリプトは省略 $strAfter = $_POST[before] . $row[sample](SQLから抜き出した変数); <form action = "http://localhost/index3.php" method = "POST"> <input type = "hidden" name = "strAfter" value = "<?php echo $strAfter;?>"> </form> 例)リンゴ:<input type = "hidden" name = "strAfter" value = "flash to php100ringo"> みかん:<input type = "hidden" name = "strAfter" value = "flash to php200mikan"> ※みかんのボタンをクリックしたとする 3)index3.php 2)からPOSTで送られてきた$_POST['strAfter'];は取得できている。 (index2.phpの form actionのURLを「index3.php」にすると「flash to php200mikan」が表示される。) index2.phpでPOSTされた変数を表示後index.htmlにジャンプさせる <?PHP $strAfter = "after=" . $_POST['strAfter']; echo $strAfter; //Flashに取得されたい変数 header("Location: http://localhost/index.html"); //もとのページに戻す exit; ?> 4)index.html+sample.swf index3.phpで表示された$strAfter(変数)を取得ができない。 この時点で「ダイナミックテキストインスタンス名:strAfter」でも「「undefined」」表示。 「flash to php200mikan」が表示されることを望む!! ●sample.fla ○1フレーム目 ・配置 MC、ボタン、テキストフィールド ボタンインスタンス名:btn1 ダイナミックテキスト変数名:strAfter ・アクション fscommand("allowscale", false); System.useCodepage=true; _root.btn1.onRelease = function () { objSendVars = new LoadVars(); objSendVars.before = "flash to php"; // これがphpに送信する変数 objSendVars.send("http://localhost/index.php", "_blank", "POST"); } // _rootにstrAfterという変数のダイナミックテキストを用意したとする var strAfter = null; objLoadVars = new LoadVars(); objLoadVars.onLoad = function() { strAfter = objLoadVars.after; } // PHPから変数を取得 objLoadVars.load("http://localhost/index3.php"); stop(); |
フラット表示 | 前のトピック | 次のトピック |
題名 | 投稿者 | 日時 |
---|---|---|
» Flash > PHP > PHP > Flash (全てPOSTで送信)で送った変数を表示させたい | ichigo15 | 2007-3-25 19:37 |
Re: Flash > PHP > PHP > Flash (全てPOSTで送信)で送った変数を表示させたい | sorano | 2007-3-25 21:36 |
Re: Flash > PHP > PHP > Flash (全てPOSTで送信)で送った変数を表示させたい | ichigo15 | 2007-3-25 22:44 |
Re: Flash > PHP > PHP > Flash (全てPOSTで送信)で送った変数を表示させたい | mayor | 2007-3-25 23:32 |
Re: Flash > PHP > PHP > Flash (全てPOSTで送信)で送った変数を表示させたい | sorano | 2007-3-26 0:21 |
Re: Flash > PHP > PHP > Flash (全てPOSTで送信)で送った変数を表示させたい | ichigo15 | 2007-3-26 0:45 |
投稿するにはまず登録を | |