回答編集履歴
2
調整
answer
CHANGED
@@ -4,4 +4,21 @@
|
|
4
4
|
$searchValue="hogehoge";
|
5
5
|
header('Location:index.php?searchValue='.urlencode($searchValue));
|
6
6
|
```
|
7
|
-
そのうえでindex.phpでgetデータを利用する
|
7
|
+
そのうえでindex.phpでgetデータを利用するとか、クッキーをつかうとか
|
8
|
+
|
9
|
+
index.php
|
10
|
+
```php
|
11
|
+
<?PHP
|
12
|
+
print_r($_COOKIE);
|
13
|
+
?>
|
14
|
+
<form method="post" action="post.php">
|
15
|
+
<input name="hoge" value="123">
|
16
|
+
<input type="submit" value="send">
|
17
|
+
</form>
|
18
|
+
```
|
19
|
+
post.php
|
20
|
+
```php
|
21
|
+
<?PHP
|
22
|
+
setCookie("searchValue","hogehoge");
|
23
|
+
header('Location:index.php');
|
24
|
+
```
|
1
tuiki
answer
CHANGED
@@ -1,1 +1,7 @@
|
|
1
|
-
indexからpostに送るとindexは閉じてしまうわけですからpostの変数を参照することはできません。
|
1
|
+
indexからpostに送るとindexは閉じてしまうわけですからpostの変数を参照することはできません。
|
2
|
+
headerで再読み込みする前提であればgetで渡し直すくらいでしょうか
|
3
|
+
```PHP
|
4
|
+
$searchValue="hogehoge";
|
5
|
+
header('Location:index.php?searchValue='.urlencode($searchValue));
|
6
|
+
```
|
7
|
+
そのうえでindex.phpでgetデータを利用する
|