Heey,
我有一个表单,我需要验证字段不为空,然后当我按下提交按钮时,它将使用createAccount.php文件插入用户引入数据库的所有信息。问题是,当我按下提交按钮时,没有任何事情发生......我不知道我在做什么。任何帮助将非常感激。这是代码:
HTML(联系表单7)
<form id="myform" action="/wp-content/plugins/my-codes/createAccount.php" method="post">
<p>Your Name (required)<br /> </p>
[text* cName id:cName]
<p>Your Surname (required)<br /> </p>
[text* cSurname id:cSurname]
<p>Your Email (required)<br /></p>
[email* cEmail id:cEmail]
<label> Your Telephone Number (required)
[tel* cPhone id:cPhone tel-106 placeholder "123 456 789"] </label>
<p>Your Address (required)<br /> </p>
[text* cAddress id:cAddress]
<select cNeighborhood id:cNeighborhood name=cNeighborhood>
<option value="Bat Yam">Bat Yam</option>
<option value="Raanana">Raanana</option>
</select>
<label> Create Password (required)
[text* cPswd id:cPswd] </label>
<label> Confirm Password (required)
[text* cPswd id:cPswd] </label>
[submit id:submit "submit"]
</form>
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://cdn.jsdelivr.net/jquery.validation/1.15.0/jquery.validate.min.js"> </script>
<script src="http://cdn.jsdelivr.net/jquery.validation/1.15.0/additional- methods.min.js"></script>
<script>
$("#myform").validate({
rules: {
},
messages: {
}
});
</script>
createAccount.php
<?php
require_once('../../../wp-load.php');
include ('../../../wp-config.php');
global $wpdb;
if(isset($_POST['submit']))
{
$name=addslashes($_POST['cName']);
$surname=addslashes($_POST['cSurname']);
$email=addslashes($_POST['cEmail']);
$phone =addslashes($_POST['cPhone']);
$otherPhone=implode($_POST['cOtherPhone']);
$languages=implode(' | ', $_POST['cLanguages']);
$address=addslashes($_POST['cAddress']);
$neighborhood=$_POST['cNeighborhood'];
$pswd=addslashes($_POST['cPswd']);
$service=$_POST['cService'];
$wpdb->insert("Client",array(
"cName"=>$name,
"cSurname"=>$surname,
"cEmail"=>$email,
"cPhone"=>$phone,
"cOtherPhone"=>$otherPhone,
"cLanguages"=>$languages,
"cAddress"=>$address,
"cNeighborhood"=>$neighborhood,
"cPswd"=>$pswd,
"cService"=>$service
));
print_r("uq");
}
$wpdb->show_errors();
?>
谢谢!