質問編集履歴
1
コードをマークダウンにしました
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,7 +28,9 @@
|
|
28
28
|
|
29
29
|
### 該当のソースコード
|
30
30
|
|
31
|
-
|
31
|
+
index.php
|
32
|
+
|
33
|
+
```ここに言語を入力
|
32
34
|
|
33
35
|
<?php
|
34
36
|
|
@@ -42,8 +44,6 @@
|
|
42
44
|
|
43
45
|
|
44
46
|
|
45
|
-
|
46
|
-
|
47
47
|
?>
|
48
48
|
|
49
49
|
|
@@ -460,7 +460,7 @@
|
|
460
460
|
|
461
461
|
type: "POST",
|
462
462
|
|
463
|
-
dataType: "
|
463
|
+
dataType: "text",
|
464
464
|
|
465
465
|
crossDomain: false,
|
466
466
|
|
@@ -472,7 +472,7 @@
|
|
472
472
|
|
473
473
|
}).done(function(data){
|
474
474
|
|
475
|
-
|
475
|
+
console.log(data);
|
476
476
|
|
477
477
|
|
478
478
|
|
@@ -542,13 +542,13 @@
|
|
542
542
|
|
543
543
|
</html>
|
544
544
|
|
545
|
-
|
545
|
+
```
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
546
|
+
|
547
|
+
|
548
|
+
|
551
|
-
|
549
|
+
select.php
|
550
|
+
|
551
|
+
```ここに言語を入力
|
552
552
|
|
553
553
|
<?php
|
554
554
|
|
@@ -564,82 +564,82 @@
|
|
564
564
|
|
565
565
|
|
566
566
|
|
567
|
+
echo "<pre>";var_dump($_POST);echo "</pre>";
|
568
|
+
|
569
|
+
// exit;
|
570
|
+
|
571
|
+
if(isset ($_POST)){
|
572
|
+
|
573
|
+
echo "ポストが来きてる";
|
574
|
+
|
575
|
+
exit;
|
576
|
+
|
577
|
+
}
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
if(array_key_exists('customer_id' , $_POST )){
|
582
|
+
|
583
|
+
echo "customer_id が来てない";
|
584
|
+
|
585
|
+
exit;
|
586
|
+
|
587
|
+
}
|
588
|
+
|
589
|
+
echo "そもそもダメ";
|
590
|
+
|
591
|
+
exit;
|
592
|
+
|
593
|
+
|
594
|
+
|
595
|
+
require_once '../../../app/config/config.php';
|
596
|
+
|
597
|
+
//直接のページ遷移を阻止
|
598
|
+
|
567
599
|
// echo "<pre>";var_dump($_POST);echo "</pre>";
|
568
600
|
|
601
|
+
$request = isset($_SERVER['HTTP_X_REQUESTED_WITH']) ? strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) : '';
|
602
|
+
|
603
|
+
// if($request == 'xmlhttprequest') exit;
|
604
|
+
|
569
|
-
//
|
605
|
+
//DBへの接続
|
606
|
+
|
570
|
-
|
607
|
+
try {
|
608
|
+
|
609
|
+
$db =getDb(array(PDO::ATTR_EMULATE_PREPARES => false));
|
610
|
+
|
571
|
-
|
611
|
+
} catch (exception $e) {
|
572
|
-
|
612
|
+
|
573
|
-
e
|
613
|
+
exit('データベース接続失敗'.$e->getMessage());
|
574
|
-
|
575
|
-
exit;
|
576
614
|
|
577
615
|
}
|
578
616
|
|
579
|
-
|
617
|
+
//ajaxで渡ってきた値を元にprojectsテーブルから該当する案件を抽出
|
580
|
-
|
618
|
+
|
581
|
-
|
619
|
+
$customer_id = $_POST['customer_id'];
|
620
|
+
|
582
|
-
|
621
|
+
$sql = 'SELECT * FROM projects WHERE customer_id =:customer_id';
|
622
|
+
|
623
|
+
$stmt=$db->prepare($sql);
|
624
|
+
|
625
|
+
$stmt->bindValue(':customer_id', $customer_id, PDO::PARAM_INT);
|
626
|
+
|
627
|
+
$stmt->execute();
|
628
|
+
|
629
|
+
|
630
|
+
|
583
|
-
|
631
|
+
//抽出された値を$project_list配列に格納
|
584
|
-
|
632
|
+
|
585
|
-
|
633
|
+
$project_list = array();
|
634
|
+
|
635
|
+
foreach($stmt as $data){
|
636
|
+
|
637
|
+
$project_list[$data['customer_id']] = $data['project_name'];
|
586
638
|
|
587
639
|
}
|
588
640
|
|
589
|
-
echo "そもそもダメ";
|
590
|
-
|
591
|
-
exit;
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
require_once '../../../app/config/config.php';
|
596
|
-
|
597
|
-
//直接のページ遷移を阻止
|
598
|
-
|
599
641
|
// echo "<pre>";var_dump($_POST);echo "</pre>";
|
600
642
|
|
601
|
-
$request = isset($_SERVER['HTTP_X_REQUESTED_WITH']) ? strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) : '';
|
602
|
-
|
603
|
-
// if($request == 'xmlhttprequest') exit;
|
604
|
-
|
605
|
-
//DBへの接続
|
606
|
-
|
607
|
-
try {
|
608
|
-
|
609
|
-
$db =getDb(array(PDO::ATTR_EMULATE_PREPARES => false));
|
610
|
-
|
611
|
-
} catch (exception $e) {
|
612
|
-
|
613
|
-
exit('データベース接続失敗'.$e->getMessage());
|
614
|
-
|
615
|
-
}
|
616
|
-
|
617
|
-
//ajaxで渡ってきた値を元にprojectsテーブルから該当する案件を抽出
|
618
|
-
|
619
|
-
$customer_id = $_POST['customer_id'];
|
620
|
-
|
621
|
-
$sql = 'SELECT * FROM projects WHERE customer_id =:customer_id';
|
622
|
-
|
623
|
-
$stmt=$db->prepare($sql);
|
624
|
-
|
625
|
-
$stmt->bindValue(':customer_id', $customer_id, PDO::PARAM_INT);
|
626
|
-
|
627
|
-
$stmt->execute();
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
//抽出された値を$project_list配列に格納
|
632
|
-
|
633
|
-
$project_list = array();
|
634
|
-
|
635
|
-
foreach($stmt as $data){
|
636
|
-
|
637
|
-
$project_list[$data['customer_id']] = $data['project_name'];
|
638
|
-
|
639
|
-
}
|
640
|
-
|
641
|
-
// echo "<pre>";var_dump($_POST);echo "</pre>";
|
642
|
-
|
643
643
|
|
644
644
|
|
645
645
|
|
@@ -648,6 +648,8 @@
|
|
648
648
|
|
649
649
|
echo json_encode($project_list);
|
650
650
|
|
651
|
+
```
|
652
|
+
|
651
653
|
### 試したこと
|
652
654
|
|
653
655
|
console.logでエラーメッセージを出力
|