<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>lalala</title>
<link rel="stylesheet" href="界面.css" type="text/css">
</head>
<body>
<div class="main">
<span>
<h2>标题</h2>
</span>
<div class="vector">
<div class="table">
<table>
<tr>
<td>手机号:</td>
<td>
<input type="text" class="text" name="tel" id="tel">
</td>
</tr>
<tr>
<td>啦啦啦:</td>
<td>
<input type="text" class="text" name="lalala" id="tel">
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" class="text" value="注册" name="submit" id="submit">
</td>
</tr>
</table>
</div>
</div>
</div>
</body>
<script src="jquery-3.3.1.min.js"></script>
<script>
var dat=$("#my_form:input").serializeArray();
$(function(){
$('#submit').click(function(){
$.post(
'处理.php',
dat,
function() {
window.location.href='result.html';
}
)
});
});
$('#submit').submit(function(){
return false;
})
</script>
</html>
html,body{
height: 100%;
width: 100%;
}
body{
background: -webkit-radial-gradient(red, green, blue); /* Safari 5.1 - 6.0 */
background: -o-radial-gradient(red, green, blue); /* Opera 11.6 - 12.0 */
background: -moz-radial-gradient(red, green, blue); /* Firefox 3.6 - 15 */
background: radial-gradient(red, green, blue);
}
@font-face{
font-family: "好看的王氏字体";
src: url(D:/工作区/字体库/Madeleina\ Sans.otf);
}
.main{
background:rgba(0, 183, 255, 0.35);
position: absolute;
top:50%;
left: 50%;
width:400px;
height:300px;
margin-left: -200px;
margin-top: -150px;
text-align: center;
font-family: '好看的王氏字体';
border-radius: 5px;
}
.vector{
margin:10% auto;
font-size: 20px;
color: gray;
font-weight: 500;
width: 300px;
}
.main h2{
text-shadow: 5px 5px 5px #FF0000;
}
.text{
height: 30px;
border-radius: 5px;
outline: none;
width: 200px;
border:0 solid grey;
color: chocolate;
}
上面是HTML+css+jQuery部分
下面是
PHP部分
<?php
header("Content-type: text/html; charset=utf-8");
$userTel = $_POST['tel'];
$lala = $_POST['lalala'];
$testJSON = array('tel' => $userTel, 'lalala' => $lala);
foreach ($testJSON as $key => $value) {
$testJSON[$key] = urlencode($value);
}
file_put_contents('界面/result.json', urldecode(json_encode($testJSON)));