I am creating a website at school for a pretend client. At this stage it is a mobile repair/shop with services and products. My aim is to get all the products on my edit page so that if an item was out of stock my (client) could login as an admin and edit the page without having to go through the database and manually do it, or change the code.
I am getting this error every time and I am out of ideas on why this might not be working. I am totally new to this.
Parse error: syntax error, unexpected end of file in /Applications/XAMPP/xamppfiles/htdocs/matthew/edit.php on line 108
Here is my code:
<?php
// Start the session
session_start();
?>
<!DOCTYPE html>
<title>Matts Mobile</title>
<link rel="stylesheet" href="css/style.css">
<body>
<header>
<div class="col span_1_of_3">
<div class="logo">
<a href="index.php"><img src="images/logo.png" style=width:150px;height:150px;></a>
</div>
</div>
<div class="col span_2_of_3">
<div class="z">
<img src="images/m3.jpg" style=width:70%;>
</div>
<div class="topnav">
<!-- ... -->
</div>
</div>
<?php
$pagenum=$_GET["pagenum"];
include 'setup.php';
if(isset($_SESSION['username'])){
if($_SESSION["username"] ==$user)
{$message= "Welcome admin"; }
} else {
header('Location: login.php');
}
//---//
$sql = "SELECT * FROM pages where pagenum = $pagenum";
$result = $conn->query($sql);
$row = mysqli_fetch_all($result,MYSQLI_ASSOC) ;
#print_r($row);
if(!$row){echo "0 results";}
else
{ $pagenum = $row[0]["pagenum"];
$pagetitle = $row[0]["pagetitle"];
$pagetext = $row[0]["pagetext"];
//print "$pagetext";}
//---//
$sql = "SELECT * FROM pages where product_id = $product_id";
$result = $conn->query($sql);
$row = mysqli_fetch_all($result,MYSQLI_ASSOC) ;
#print_r($row);
if(!$row){echo "0 results";}
else
{ $product_id = $row[0]["product_id"];
$name = $row[0]["name"];
$price = $row[0]["price"];
$image = $row[0]["image"];
//print "$name";}
//---//
$conn->close();
?>
</header>
<main>
<div class="main_container">
<form action="update.php" method="post">
Page Number: <input type="text" name="pagenum" value="<?php echo $pagenum; ?>" ><br>
Page Title: <input type="text" name="pagetitle" value="<?php echo $pagetitle; ?>" ><br>
Products:
1<input type="checkbox" name="stock" value="<?php echo $product_id=1; ?>" >
2<input type="checkbox" name="stock" value="<?php echo $product_id=2; ?>" >
<textarea name="pagetext" rows="5" cols="40"><?php echo $pagetext;?></textarea>
<input type="submit">
</form>
</div>
</main>
</body>