Jan 18th, 2018, 12:05 PM
I'm trying to setup hooks manager to send the data submitted to another database. I want this to grab the values entered and send them all to another database when the form is submitted. Below is the code and I have it set for the
hook with a rule priority at 1:
if ($_POST["timer_container"] > 0)
{
// Server Vars
$servername = "***.***.***";
$username = "********";
$password = "********";
$dbname = "********";
// Form Variables
$TypeVal = $_POST["TypeVal"];
$moldID = $_POST["moldID"];
$last_modified_date = $time_stamp;
$timer_container = $_POST["timer_container"];
$q1 = $_POST["q1"];
$q2 = $_POST["q2"];
$q3 = $_POST["q3"];
$q4 = $_POST["q4"];
$q5 = $_POST["q5"];
$q6 = $_POST["q6"];
$q7 = $_POST["q7"];
$q8 = $_POST["q8"];
$q9 = $_POST["q9"];
$q10 = $_POST["q10"];
$q11 = $_POST["q11"];
$q12 = $_POST["q12"];
$q13 = $_POST["q13"];
$notes = $_POST["notes"];
$employeeID = $_POST["employeeID"];
$machine = $_POST["machine"];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO moldpm (TypeVal, Machine, Time_Stamp, Elapsed,
Q01, Q02, Q03, Q04, Q05, Q06, Q07, Q08, Q09, Q10, Q11, Q12, Q13, Q14, Q15,
Notes, Employee, Press)
VALUES($scada_pdo, $scada_sql, $TypeVal, $moldID, $last_modified_date, $timer_container, $q1, $q2, $q3, $q4, $q5, $q6, $q7, $q8, $q9, $q10, $q11, $q12, $q13, 5, 5, $notes, $employeeID, $machine)";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
}
Can anyone help me out? Not sure if I'm fully understanding the hooks manager.
Code:
ft_finalize_form, end
if ($_POST["timer_container"] > 0)
{
// Server Vars
$servername = "***.***.***";
$username = "********";
$password = "********";
$dbname = "********";
// Form Variables
$TypeVal = $_POST["TypeVal"];
$moldID = $_POST["moldID"];
$last_modified_date = $time_stamp;
$timer_container = $_POST["timer_container"];
$q1 = $_POST["q1"];
$q2 = $_POST["q2"];
$q3 = $_POST["q3"];
$q4 = $_POST["q4"];
$q5 = $_POST["q5"];
$q6 = $_POST["q6"];
$q7 = $_POST["q7"];
$q8 = $_POST["q8"];
$q9 = $_POST["q9"];
$q10 = $_POST["q10"];
$q11 = $_POST["q11"];
$q12 = $_POST["q12"];
$q13 = $_POST["q13"];
$notes = $_POST["notes"];
$employeeID = $_POST["employeeID"];
$machine = $_POST["machine"];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO moldpm (TypeVal, Machine, Time_Stamp, Elapsed,
Q01, Q02, Q03, Q04, Q05, Q06, Q07, Q08, Q09, Q10, Q11, Q12, Q13, Q14, Q15,
Notes, Employee, Press)
VALUES($scada_pdo, $scada_sql, $TypeVal, $moldID, $last_modified_date, $timer_container, $q1, $q2, $q3, $q4, $q5, $q6, $q7, $q8, $q9, $q10, $q11, $q12, $q13, 5, 5, $notes, $employeeID, $machine)";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
}
Can anyone help me out? Not sure if I'm fully understanding the hooks manager.