JS not passing to php

limited

New Member
Hi, I'm baffled here; the two following statements from my JS
file displays the correct values but the code to enter them
into a table enters zeroes. I tried document.write(s) and the
correct values were displayed.what am I missing? Thanks in advance.

Code:
var expression = value1 + op +value2 +'='+ total;
alert(expression);
------------------------------------
PHP:
<?php 
include('calcbegin.html');
$servername = "localhost";
$username = "root";table
$password = "cookie";
$dbname = "homedb";
 show 
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
 // Check connection
 if ($conn->connect_error)
 { die("Connection failed: " . $conn->connect_error); } 

$sql = "INSERT INTO calculator (purpose, value1, op, value2, total)
VALUES ('$purpose', '$value1', '$op', '$value2', '$total')";
if ($conn->query($sql) === TRUE)
 { echo "New record created successfully"; }
 else
 { echo "Error: " . $sql . "<br>" . $conn->error; }
$conn->close();
 ?>
 
Back
Top