teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

htmlの追加

2018/12/10 03:03

投稿

mori-.-
mori-.-

スコア18

title CHANGED
File without changes
body CHANGED
@@ -14,6 +14,9 @@
14
14
 
15
15
  </script>
16
16
  ```
17
+ ```html
18
+ <div class="search"></div>
19
+ ```
17
20
 
18
21
  呼び出し先 search.php
19
22
  ```PHP

1

ソースコードの追加

2018/12/10 03:02

投稿

mori-.-
mori-.-

スコア18

title CHANGED
File without changes
body CHANGED
@@ -1,3 +1,50 @@
1
1
  呼び出し元にあるGETの値を呼び出し先で使用したいのですが、この場合通常の$_GET["値"]での取得はできないのでしょうか...?
2
2
 
3
+ 呼び出し先と同じものを呼び出し元で使用すると受け取れるのですが、
4
+ 呼び出し先でうまく表示できません
5
+
3
- よろしければ教えてください。
6
+ よろしければ教えてください。
7
+
8
+ 呼び出し元
9
+ ```JQuery
10
+ <script type="text/javascript">
11
+ $(function() {
12
+ $(".search").load("include/search.php");
13
+ });
14
+
15
+ </script>
16
+ ```
17
+
18
+ 呼び出し先 search.php
19
+ ```PHP
20
+ <?php
21
+ $year = date("Y");
22
+ $month = date("n");
23
+ $day = date("j");
24
+ $date="";
25
+ if(isset($_GET["year"]) && isset($_GET["month"]) && isset($_GET["day"])){
26
+ $year = $_GET["year"];
27
+ $month = $_GET["month"];
28
+ $day = $_GET["day"];
29
+ }
30
+ if(isset($_GET["date"])){
31
+ $date= $_GET["date"];
32
+ }
33
+
34
+ echo $year.$month.$day.$date;
35
+ ?>
36
+ ```
37
+
38
+ ```html
39
+ <form method="get">
40
+ <div id="search-bar">
41
+ <select name="year" id="bar_year" class="sel_year">
42
+ </select>年
43
+ <select name="month" id="bar_month" class="sel_month">
44
+ </select>月
45
+ <select name="day" id="bar_day" class="sel_day">
46
+ </select>日
47
+ <button id="search-button">検索</button>
48
+ </div>
49
+ </form>
50
+ ```