Как исправить ошибку синтаксического анализа: синтаксическая ошибка, неожиданный '{' в C:\xampp\htdocs\code\contact-view.php на линии 10
<?php session_start(); if (isset($_POST['userName']) && isset($_POST['userEmail']) && isset($_POST['subject']) && isset($_POST['content']) && !empty($_POST['username'] && !empty($_POST['userEmail'] && !empty($_POST['subject'] && !empty($_POST['content'])){ $server = "localhost"; $user = "root"; $pass = ""; $dbname = "data"; //Creating connection for mysqli $conn = new mysqli($server, $user, $pass, $dbname); //Checking connection if($conn->connect_error){ die("Connection failed:" . $conn->connect_error); } <html> <head> <h1 class="logo"></h1> <div id="form-wrapper" style="max-width:500px;margin:auto;"> <style type="text/css" media="all"> .form_table { text-align: center; } .full_width .segment_header { text-align: center !important; } .q { float:none;display: inline-block; } table.matrix, table.rating_ranking { margin-left:auto !important;margin-right:auto !important; } </style> <link rel="stylesheet" type="text/css" href="style.css"> <title>Form Request</title> <link rel="stylesheet" type="text/css" href="style.css" /> <style type="text/css" media="all"> .form_table { text-align: center; } .full_width .segment_header { text-align: center !important; } .q { float:none;display: inline-block; } table.matrix, table.rating_ranking { margin-left:auto !important;margin-right:auto !important; } </style> </head> <body> <div id="modal-wrapper" class="modal"> <h1 style="text-align:center"></h1> <div class="form-container"> <form name="frmContact" id="formcontact" method="post" action="send_mail.php" enctype="multipart/form-data" onsubmit="return validateContactForm()"> <div class="input-row"> <label style="padding-top: 20px;">Name</label> <span id="userName-info" class="info"></span><br /> <input type="text" class="input-field" name="userName" placeholder="Name" id="userName" /> </div> <div class="input-row"> <label>Email</label> <span id="userEmail-info" class="info"></span><br /> <input type="text" class="input-field" name="userEmail" placeholder="Email" id="userEmail" /> </div> <div class="input-row"> <label>Call No</label> <span id="subject-info" class="info"></span><br /> <input type="text" class="input-field" name="subject" placeholder="subject" id="subject" /> </div> <div class="input-row"> <label>Message</label> <span id="userMessage-info" class="info"></span><br /> <textarea name="content" id="content" placeholder="content" class="input-field" cols="60" rows="6"></textarea> </div> <div> <input type="submit" name="send" class="btn-submit" value="Send" /> <div id="statusMessage"> <?php if (! empty($message)) { ?> <p class='<?php echo $type; ?>Message'><?php echo $message; ?></p> <?php } ?> </div> </div> </form> </div> </div> <script> <script src="https://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script> <script type="text/javascript"> function validateContactForm() { var valid = true; $(".info").html(""); $(".input-field").css('border', '#e0dfdf 1px solid'); var userName = $("#userName").val(); var userEmail = $("#userEmail").val(); var subject = $("#subject").val(); var content = $("#content").val(); if (userName == "") { $("#userName-info").html("Required."); $("#userName").css('border', '#e66262 1px solid'); valid = false; } if (userEmail == "") { $("#userEmail-info").html("Required."); $("#userEmail").css('border', '#e66262 1px solid'); valid = false; } if (!userEmail.match(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/)) { $("#userEmail-info").html("Invalid Email Address."); $("#userEmail").css('border', '#e66262 1px solid'); valid = false; } if (subject == "") { $("#subject-info").html("Required."); $("#subject").css('border', '#e66262 1px solid'); valid = false; } if (content == "") { $("#userMessage-info").html("Required."); $("#content").css('border', '#e66262 1px solid'); valid = false; } return valid; } </script> </div> </body> </html>
Что я уже пробовал:
Я пробовал использовать session start();
переполнение стека дает не решения, а больше ошибок