-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form-Processing.php
84 lines (64 loc) · 2.09 KB
/
Form-Processing.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html lang="en">
<head>
<link href="ressource/css/bootstrap.css" rel="stylesheet">
</head>
<body>
<?php
/**
* Created by PhpStorm.
* User: Mohamed-Amine
* Date: 25/01/2016
* Time: 08:34
*/
include "entity/Connection.php";
include "entity/Incident.php";
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$email = $_POST['email'];
$adresse = $_POST['adresse'];
$numero = $_POST['numero'];
$severite = $_POST['optionsRadios'];
$description = $_POST['description'];
$type = $_POST['typeIncident'];
//$photo = $_FILES['photo'];
echo basename($_FILES["photo"]["name"]);
$info = pathinfo($_FILES['photo']['name']);
$ext = $info['extension']; // get the extension of the file
$newname = "$nom"."_photoIncident.".$ext;
$target = 'ressource/photo/'.$newname;
move_uploaded_file( $_FILES['photo']['tmp_name'], $target);
//$target_Path = "ressource/photo/";
//$target_Path = $target_Path.basename( $_FILES['photo']['name'] );
//move_uploaded_file( $_FILES['photo']['tmp_name'], $target_Path );
//
if (isset($_POST['check_web']))
$reference = $_POST['check_web'];
if (isset($_POST['check_tel']))
$reference = $_POST['check_tel'];
if (isset($_POST['check_email']))
$reference = $_POST['check_email'];
echo "<h1>Recuperation variables</h1>";
echo "Nom : {$nom} <br />";
echo "Prénom : {$prenom} <br />";
echo "Adresse : {$adresse} <br />";
echo "Type : {$type} <br />";
echo "Description : {$description} <br />";
echo "severite : {$severite} <br />";
echo "Référence : {$reference} <br />";
if (isset($_FILES['photo'])) {
echo "Photo : ".$_FILES['photo']['name'];
}
$incident = new Incident($description, $type, $adresse, $severite, $reference, $target);
/*** La connection à la DB ***/
$database = new Connection("localhost", "root", "root");
/*** L'insertion dans la table incident ***/
$count = $database->insertIntoIncident($incident);
echo $count;
/*** Déconnexion de la DB ***/
$database->closeConnection();
$html = "<br/><br/><button class=\"btn btn-success\" type=\"button\" onclick=\"window.location.href='Display.php'\">Montrer les plaintes</button>";
echo $html;
?>
</body>
</HTML>