-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharEdit_Commit.php
63 lines (47 loc) · 1.76 KB
/
CharEdit_Commit.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
<?php
$title = "Edit Character Commit";
include 'header.php';
include 'DBHelper.php';
include "db_queries.php";
if ( isset( $_POST['submit'] ) ) {
// retrieve the form data by using the element's name attributes value as key
$f_name = db_quote($_POST['f_name']);
$l_name = db_quote($_POST['l_name']);
$call_sign = db_quote($_POST['callsign']);
$title = db_quote($_POST['title']);
$cid = ($_POST['cid']);
$gender = db_quote($_POST['gender']);
$iconic = db_quote($_POST['iconic']);
$plan_pid = ($_POST['planetselect']);
if ($iconic != "TRUE") {
echo 'Not Iconic<br />';
$iconic = 1;
} else {
echo 'Iconic character<br />';
$iconic = 0;
}
//display the results
echo '<h3>Editing and Sending this stuff</h3>';
echo 'Character ID: '.$cid.'<br />';
echo 'First Name:' . $f_name . '<br />';
echo 'Last Name:' . $l_name . '<br />';
echo 'Call Sign:' . $call_sign . '<br />';
echo 'Title:' . $title . '<br />';
echo 'Gender:' . $gender . '<br />';
echo 'Iconic:' . $iconic . '<br />';
echo 'Planet ID:' . $plan_pid . '<br />';
$qry = "UPDATE swdb_characters c SET c.f_name ='".$f_name."', c.l_name ='".$l_name."', c.call_sign ='".$call_sign."', c.title ='".$title."', c.Gender = '".$gender."', c.iconic = '".$iconic."', c.Planets_pid = '".$plan_pid."' WHERE c.cid ='".$cid."'";
echo 'The query string is: '.$qry;
$update = db_query($qry);
echo '<br />The query has executed! <br />';
$err = db_error();
if ($err != null) {
echo $err;
}
} else {
echo "Error receiving data from the post!";
}
?>
<script>
window.location = "Characters.php";
</script>