<?php
$name = $_POST['name'];
$price = $_POST['price'];
$absolute_path = "/Plants/List/index.html";
$PlantFile = fopen($_SERVER['DOCUMENT_ROOT'] . "$absolute_path", "a") or die("Unable to open file!");
$trimmedname = preg_replace('/\s+/', '', $name);
fwrite($PlantFile, "\n\n<div class='wrapper one $trimmedname' id='main'>\n<h1>$name</h1>\n<p>Price: $price</p>\n <?php if($_SESSION[id]) {?> \n<button>Delete $name</button>\n<script> var simple = \"<?php echo $trimmedname; ?>\"; $(\"button\").click(function(){$(simple).remove();}); </script> \n <?php } ?> \n</div>\n");
fclose($PlantFile);
?>
I keep getting the error:
Parse error: syntax error, unexpected '(', expecting variable (T_VARIABLE) or '$' in your code on line 9
Could anyone help? Thanks guys!