Jump to content

Error


underknown

Recommended Posts

Parse error: syntax error, unexpected T_VARIABLE in Z:\www\website\center.php on line 35

 

This error is coming up when attempting to run the following code.  line 35 is the one containing the $query statement. :/

 

<?php include("header.php"); ?>
<?php include("topmenu.php"); ?>
<?php include("menu.php"); ?>
<?php include("news.php"); ?>
<?php include("links.php"); ?>
<?php include("info.php"); ?>

<div id="column2">
<h1>introduction</h1>

<!-- **** INSERT PAGE CONTENT HERE **** -->

<p>
This page can be used to insert new customers.
</p>

<?php

//Check Form Submission
if (isset($_POST['Create'])) {

//Extract Values
$surname = $_POST['surname'];
$givenname = $_POST['given_name'];
$address = $_POST['address'];
$city = $_POST['city'];
$province = $_POST['province'];
$postalcode = $_POST['postal_code'];
$phonenumber = $_POST['phone_number'];

//Connect to Database
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PW, DB_NAME)

//Insert Query
$query = "INSERT INTO customers (surname, given_name, address, city, province, postal_code, phone_number) VALUES ('$surname', '$givenname', '$address', '$city', '$province', '$postalcode', '$phonenumber') ";

//Execute Query
mysqli_query($dbc, $query) or die ("Error inserting data.");

//Close Connection
mysqli_close($dbc)

//Confirm
echo 'Customer Added.<br />';

}

?>

<!-- Create the Form to Add Users -->
<form method = "post" action = "<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="surname">Surname:</label><input type="text" id="surname" name="surname"><br />
    <label for="given_name">First Name:</label><input type="text" id="given_name" name="given_name"><br />
    <label for="address">Address:</label><input type="text" id="address" name="address"><br />
<label for="city">City:</label><input type="text" id="city" name="city"><br />
<label for="province">Province:</label><input type="text" id="province" name="province"><br />
<label for="postal_code">Postal Code:</label><input type="text" id="postal_code" name="postal_code"><br />
    <label for="phone_number">Phone Number:</label><input type="text" id="phone_number" name="phone_number"><br />
    <input type = "submit" name = "Create" value = "Create" />
</form>

</div>
</div>

</div>
</body>
</html>

 

Link to comment
https://forums.phpfreaks.com/topic/216313-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.