-
Notifications
You must be signed in to change notification settings - Fork 1
/
helpersScript.php
38 lines (29 loc) · 1.12 KB
/
helpersScript.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
<?php
require 'dbhScript.php';
if(isset($_POST['submithelpers'])){
$name = $_POST['name'];
$zipcode = $_POST['zipcode'];
if(isset($_POST['serviceprovider'])){
$servicesOffered = $_POST['serviceprovider'];
} else {
echo 'You need to choose one option!';
exit();
}
$contact = $_POST['contact'];
$extra = $_POST['extra'];
$sql = "INSERT INTO helpers (name, zipcode, services, contact, extra) VALUES (?, ?, ?, ?, ?)"; //need to bind params for placeholders to work
$statement = mysqli_stmt_init($connection);
if(!mysqli_stmt_prepare($statement, $sql)){
header('connections.php?somethingwrong');
exit();
} else {
//storing info in database (3 params of info)
mysqli_stmt_bind_param($statement, "sssss", $name, $zipcode, $servicesOffered, $contact, $extra);
mysqli_stmt_execute($statement);
header ('Location: helpRequestsScript.php');
}
}
mysqli_close($connection);
?>
<main>
</main>