如何修复解析错误:语法错误,第10行的C:\ xampp \\\\\\\\\\\\\\\\\\\\\\\\\\\\\ [英] How do I fix parse error: syntax error, unexpected '{' in C:\xampp\htdocs\code\contact-view.php on line 10
本文介绍了如何修复解析错误:语法错误,第10行的C:\ xampp \\\\\\\\\\\\\\\\\\\\\\\\\\\\\的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<?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();
堆栈溢出不提供解决方案但更多错误
What I have tried:
I have tried using session start();
stack overflow is not giving solutions but more errors
推荐答案
_POST ['userName'])&&
isset(
_POST['userName']) && isset(
_POST ['userEmail'])&&
isset(
_POST['userEmail']) && isset(
_POST ['subject'])&&
isset(
_POST['subject']) && isset(
这篇关于如何修复解析错误:语法错误,第10行的C:\ xampp \\\\\\\\\\\\\\\\\\\\\\\\\\\\\的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文