質問編集履歴
1
編集・追記依頼に見直し対応。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,26 +1,27 @@
|
|
1
|
-
|
1
|
+
### 前提・実現したいこと
|
2
2
|
ウインドウ1からテキストボックスに入力したデータを、
|
3
3
|
<form action="ウインドウ2.php" method="POST"で、
|
4
|
-
<input type="text" name='pr_name'>したデータ(pr_name)内容をウインドウ2に渡して
|
4
|
+
<input type="text" name='pr_name'>したデータ(pr_name)内容をウインドウ2に渡して$_POST["pr_name"]で取得がしたい。
|
5
|
-
$_POST["pr_name"]で取得がしたい。
|
6
5
|
尚、ウインドウ2はポップウインドウで開きたい。です。
|
7
6
|
|
7
|
+
|
8
|
+
|
9
|
+
### 発生している問題・エラーメッセージ
|
8
10
|
<現状>
|
9
11
|
--source構成内容--
|
10
|
-
1.pos_ok.phpからpopwin1.php ...post sabmitで別windowで$_POSTは内容表示受取出来たが、
|
12
|
+
1.pos_ok.phpからpopwin1.php ...post sabmitで別windowで$_POSTは内容表示受取出来たが、タブ表示でしか出来ない。
|
11
|
-
タブ表示でしか出来ない。
|
12
13
|
2.pos_ng.phpからpopwin1.php ...ウインドウはポップ表示出来たが、$_POSTは受信が出来ない。
|
13
14
|
また、どちらも子ウインドウから呼び出した親ウィンドウへデータの渡しは出来ている。
|
14
15
|
|
15
16
|
<何故?>
|
16
|
-
submitにonclick="windowを指定しているとpostされた情報が伝送されない?たぶん使い方に..
|
17
|
+
submitにonclick="windowを指定しているとpostされた情報が伝送されない?たぶん使い方に..誤りがあるのかな? 是非ご教授頂きたくお願いします。
|
17
|
-
誤りがあるのかな? 是非ご教授頂きたくお願いします。
|
18
18
|
|
19
|
+
|
19
|
-
|
20
|
+
### 該当のソースコード
|
20
|
-
|
21
|
+
(pos_ok.php)
|
21
22
|
<!-- php id :pos_ok.php
|
22
|
-
|
23
|
+
コメント :post sabmitで別windowで$_POSTはokだがタブになってしまう。 -->
|
23
|
-
|
24
|
+
|
24
25
|
<html>
|
25
26
|
<head>
|
26
27
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
@@ -30,7 +31,7 @@
|
|
30
31
|
<script type="text/javascript">
|
31
32
|
<!--
|
32
33
|
function openwin_1() {
|
33
|
-
|
34
|
+
window.open("popwin1.php", "", "width=500,height=400" );
|
34
35
|
}
|
35
36
|
// -->
|
36
37
|
</script>
|
@@ -49,10 +50,10 @@
|
|
49
50
|
echo '</button>';
|
50
51
|
?>
|
51
52
|
|
52
|
-
|
53
|
+
(pos_ng.php)
|
53
54
|
<!-- php id :pos_ng.php
|
54
|
-
|
55
|
+
コメント :post sabmitで別windowにデータを渡すが$_POSTが取れずNGでした。 -->
|
55
|
-
|
56
|
+
|
56
57
|
<html>
|
57
58
|
<head>
|
58
59
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
@@ -62,7 +63,7 @@
|
|
62
63
|
<script type="text/javascript">
|
63
64
|
<!--
|
64
65
|
function openwin_1() {
|
65
|
-
|
66
|
+
window.open("popwin1.php", "", "width=500,height=400" );
|
66
67
|
}
|
67
68
|
// -->
|
68
69
|
</script>
|
@@ -84,10 +85,10 @@
|
|
84
85
|
|
85
86
|
?>
|
86
87
|
|
87
|
-
|
88
|
+
(popwin1.php)受信側
|
88
89
|
<!-- php id :popwin1.php
|
89
|
-
|
90
|
+
コメント :受信側別pop window -->
|
90
|
-
|
91
|
+
|
91
92
|
<html>
|
92
93
|
<head>
|
93
94
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
@@ -97,15 +98,15 @@
|
|
97
98
|
<script type="text/javascript">
|
98
99
|
<!--
|
99
100
|
function returnWindow() {
|
100
|
-
|
101
|
+
// 親ウィンドウの存在チェック
|
101
|
-
|
102
|
+
if(!window.opener || window.opener.closed){
|
102
|
-
|
103
|
+
window.alert('親ウィンドウがありません。');
|
103
|
-
|
104
|
+
return false;
|
104
|
-
}
|
105
|
-
// 子ウィンドから親ウィンドウへ値を渡す
|
106
|
-
window.opener.document.getElementById("id_pr_name").value = document.getElementById("chl_name").value;
|
107
|
-
window.opener.document.getElementById("id_pr_age").value = document.getElementById("chl_age").value;
|
108
105
|
}
|
106
|
+
// 子ウィンドから親ウィンドウへ値を渡す
|
107
|
+
window.opener.document.getElementById("id_pr_name").value = document.getElementById("chl_name").value;
|
108
|
+
window.opener.document.getElementById("id_pr_age").value = document.getElementById("chl_age").value;
|
109
|
+
}
|
109
110
|
-->
|
110
111
|
</script>
|
111
112
|
|
@@ -120,6 +121,11 @@
|
|
120
121
|
echo "php変数受け取り(pr_age)".$_POST["pr_age"];
|
121
122
|
?>
|
122
123
|
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
123
|
-
|
128
|
+
### 試したこと
|
129
|
+
|
124
130
|
上記スクリプトを実行して頂くと、pos_ok.phpの場合とpos_ng.phpの場合がわかると思います。
|
125
131
|
大変お手数ですが、ご教授頂けますと幸いです。よろしくお願いいたします。
|