入力変数に基づいて動的に生成されたページをセットアップするために使用しているphpファイルがあります。単純な文字列ではなく、複雑な Google Earth オブジェクトである変数が収集される index.html ページから開始します。そのページを送信すると、別のページに投稿され、作成されたファイルにリダイレクトされます。ページの生成に使用されるphpインクルードファイル内でその変数を使用しようとすると、問題が発生します。このフォームから変数を適切に取得し、それを通過させて、新しく生成されたページで使用できるようにするにはどうすればよいですか. これが私が現在試していることです。
このボタンをクリックすると、変数 flyto1view が設定されます。
$("#flyto1").click(function(){
if (!flyto1view){
flyto1view = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
$("#flyto1view1").val(flyto1view)
}
else {
ge.getView().setAbstractView(flyto1view);
}
});
次に、ここから非表示フィールドに値を設定しようとしましたが、そのような変数にそのように設定できる値があるかどうかはわかりません。投稿後にこの変数をここに取得する最良の方法は何ですか
<?
if (isset($_POST['submit']) && $_POST['submit']=="Submit" && !empty($_POST['address'])) {//if submit button clicked and name field is not empty
$flyto1view1 = $_POST['flyto1'];
$address = $_POST['address']; //the entered name
$l = $address{0}; // the first letter of the name
// Create the subdirectory:
// this creates the subdirectory, $l, if it does not already exists
// Note: this subdirectory is created in current directory that this php file is in.
if(!file_exists($l))
{
mkdir($l);
}
// End create directory
// Create the file:
$fileName = dirname(__FILE__)."/$address.html"; // names the file $name
$fh = fopen($fileName, 'w') or die("can't open file");
// The html code:
// this will outpout: My name is (address) !
$str = "
<? php include ('template.php') ?>
";
fwrite($fh, $str);
fclose($fh);
// End create file
echo "Congradualations!<br />
The file has been created.
Go to it by clicking <a href=\"$address.html\">here</a>.";
die();
}
// The form:
?>