- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建注册表单,但是当我单击“注册”按钮时什么也没有发生。我尝试检查我的代码,但看不出哪里出了问题。请帮忙。
index.php
<?php
include("Login.php");
include("saga_files/saga_index_file/saga_SignUp_file/SignUp.php");
?>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>UniSaga</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/ionicons.min.css" />
<link rel="stylesheet" href="css/font-awesome.min.css" />
<!--Google Font-->
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,400i,700,700i" rel="stylesheet">
<!--Favicon-->
<link rel="shortcut icon" type="image/png" href="images/fav.png"/>
</head>
<script>
function time_get()
{
d = new Date();
mon = d.getMonth()+1;
time = d.getDate()+"-"+mon+"-"+d.getFullYear()+" "+d.getHours()+":"+d.getMinutes();
Reg.saga_join_time.value=time;
}
</script>
<header id="header-inverse">
<nav class="navbar navbar-default navbar-fixed-top menu">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index-register.html"><img src="images/logo.png" alt="logo" /></a>
</div>
</div>
</nav>
</header>
<div id="lp-register">
<div class="container wrapper">
<div class="row">
<div class="col-sm-5">
<div class="intro-texts">
<h1 class="text-white">UniSaga</h1>
<p>Connect With Students from other Your University and Other Universities and get the latest news on what is Happening Around these learning Institutions. <br /> <br />What Are You Waiting For. Join Now And Experience It Like Never Before.</p>
</div>
</div>
<div class="col-sm-6 col-sm-offset-1">
<div class="reg-form-container">
<div class="reg-options">
<ul class="nav nav-tabs">
<li class="active"><a href="#register" data-toggle="tab">Register</a></li>
<li><a href="#login" data-toggle="tab">Login</a></li>
</ul><!--Tabs End-->
</div>
<!--Registration Form Contents-->
<div class="tab-content">
<div class="tab-pane active" id="register">
<h3>Register Now !!!</h3>
<p class="text-muted">Its Free and Always Will Be.</p>
<!--Register Form-->
<form method="post" name="registration_form" id='registration_form' class="form-inline">
<div class="row">
<div class="form-group col-xs-6">
<label for="first_name" class="sr-only">First Name</label>
<input id="first_name" class="form-control input-group-lg" type="text" name="first_name" title="Enter first name" placeholder="First name"/>
</div>
<div class="form-group col-xs-6">
<label for="last_name" class="sr-only">Last Name</label>
<input id="last_name" class="form-control input-group-lg" type="text" name="last_name" title="Enter last name" placeholder="Last name"/>
</div>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="email" class="sr-only">Email</label>
<input id="email" class="form-control input-group-lg" type="text" name="email" title="Enter Email" placeholder="Your Email"/>
</div>
<div class="form-group col-xs-12">
<label for="remail" class="sr-only">Re-Enter Email</label>
<input id="remail" class="form-control input-group-lg" type="text" name="remail" title="Enter Email" placeholder="Re-Enter Your Email"/>
</div>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="password" class="sr-only">Password</label>
<input id="password" class="form-control input-group-lg" type="password" name="password" title="Enter password" placeholder="Password"/>
</div>
</div>
<div class="row">
<p class="birth"><strong>Date of Birth</strong></p>
<div class="form-group col-sm-3 col-xs-6">
<label for="month" class="sr-only"></label>
<select name="day" class="form-control" id="Day">
<option value="Day" disabled selected>Day</option>
<script type="text/javascript">
for(i=1;i<=31;i++)
{
document.write("<option value='"+i+"'>" + i + "</option>");
}
</script>
</select>
</div>
<div class="form-group col-sm-3 col-xs-6">
<label for="month" class="sr-only"></label>
<select name="month" class="form-control" id="Month">
<option value="Month" disabled selected>Month</option>
<script type="text/javascript">
var m=new Array("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
for(i=1;i<=m.length-1;i++)
{
document.write("<option value='"+i+"'>" + m[i] + "</option>");
}
</script>
</select>
</div>
<div class="form-group col-sm-6 col-xs-12">
<label for="year" class="sr-only"></label>
<select name="year" class="form-control" id="Year">
<option value="Year" disabled selected>Year</option>
<script type="text/javascript">
for(i=2000;i>=1960;i--)
{
document.write("<option value='"+i+"'>" + i + "</option>");
}
</script>
</select>
</div>
</div>
<div class="form-group gender">
<select name="sex" style="width:120;height:35;font-size:18px;padding:3;">
<option value="Select Sex:"> Select Sex: </option>
<option value="Female"> Female </option>
<option value="Male"> Male </option>
</select>
</div>
<div class="row">
<div class="form-group col-xs-6">
<label for="campus" class="sr-only">Campus</label>
<input id="campus" class="form-control input-group-lg reg_name" type="text" name="campus" title="Enter campus" placeholder="Your campus"/>
</div>
<div class="form-group col-xs-6">
<label for="county" class="sr-only"></label>
<select name="county" class="form-control" id="county">
<option value="county" disabled selected>County</option>
<option value="Baringo">Baringo</option>
<option value="Bomet">Bomet</option>
<option value="Bungoma">Bungoma</option>
<option value="Busia">Busia</option>
<option value="Elgeyo">Elgeyo Marakwet</option>
<option value="Embu">Embu</option>
<option value="Garissa">Garissa</option>
<option value="Homa">Homa Bay</option>
<option value="Isiolo">Isiolo</option>
<option value="Kajiado">Kajiado</option>
<option value="Kakamega">Kakamega</option>
<option value="Kericho">Kericho</option>
<option value="Kiambu">Kiambu</option>
<option value="Kilifi">Kilifi</option>
<option value="Kirinyaga">Kirinyaga</option>
<option value="Kisii">Kisii</option>
<option value="Kisumu">Kisumu</option>
<option value="Kitui">Kitui</option>
<option value="Kwale">Kwale</option>
<option value="Laikipia">Laikipia</option>
<option value="Lamu">Lamu</option>
<option value="Machakos">Machakos</option>
<option value="Makueni">Makueni</option>
<option value="Mandera">Mandera</option>
<option value="Meru">Meru</option>
<option value="Migori">Migori</option>
<option value="Marsabit">Marsabit</option>
<option value="Mombasa">Mombasa</option>
<option value="Muranga">Muranga</option>
<option value="Nairobi">Nairobi</option>
<option value="Nakuru">Nakuru</option>
<option value="Nandi">Nandi</option>
<option value="Narok">Narok</option>
<option value="Nyamira">Nyamira</option>
<option value="Nyandarua">Nyandarua</option>
<option value="Nyeri">Nyeri</option>
<option value="Samburu">Samburu</option>
<option value="Siaya">Siaya</option>
<option value="Taita">Taita Taveta</option>
<option value="Tana">Tana River</option>
<option value="Tharaka">Tharaka Nithi</option>
<option value="Trans">Trans Zoia</option>
<option value="Turkana">Turkana</option>
<option value="Uasin">Uasin Gishu</option>
<option value="Vihiga">Vihiga</option>
<option value="Wajir">Wajir</option>
<option value="West">West Pokot</option>
</select>
</div>
</div>
</form>
<input type="hidden" name="saga_join_time">
<button type="submit" name="signup" id="sign_button" class="btn btn-primary" / onClick="time_get()" >Register Now</button>
</div>
<div class="tab-pane" id="login">
<h3>Login</h3>
<p class="text-muted">Log into your account</p>
<!--Login Form-->
<form name="Login_form" id='Login_form'>
<div class="row">
<div class="form-group col-xs-12">
<label for="my-email" class="sr-only">Email</label>
<input id="my-email" class="form-control input-group-lg" type="text" name="username" title="Enter Email" placeholder="Your Email"/>
</div>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="my-password" class="sr-only">Password</label>
<input id="my-password" class="form-control input-group-lg" type="password" name="password" title="Enter password" placeholder="Password"/>
</div>
</div>
</form><!--Login Form Ends-->
<p><a href="Forgot_Password.php">Forgot Password</a></p>
<button name="Login" id="login_button" class="btn btn-primary">Login Now</button>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-sm-offset-6">
<!--Social Icons-->
<ul class="list-inline social-icons">
<li><a href="#"><i class="icon ion-social-facebook"></i></a></li>
<li><a href="#"><i class="icon ion-social-twitter"></i></a></li>
<li><a href="#"><i class="icon ion-social-googleplus"></i></a></li>
<li><a href="#"><i class="icon ion-social-pinterest"></i></a></li>
<li><a href="#"><i class="icon ion-social-linkedin"></i></a></li>
</ul>
</div>
</div>
</div>
</div>
<!--preloader-->
<div id="spinner-wrapper">
<div class="spinner"></div>
</div>
<!-- Scripts
================================================= -->
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.appear.min.js"></script>
<script src="js/jquery.incremental-counter.js"></script>
<script src="js/script.js"></script>
</body>
</html>
<?php
include("saga_files/saga_index_file/saga_erorr_file/saga_erorr.php");
?>
</body>
</html>
SignUp.php
<?php
if(isset($_POST['signup']))
{
error_reporting(1);
$connection = mysqli_connect('localhost','root','','uni-saga');
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$Email=$_POST['email'];
$que1=mysqli_query($connection,"select * from users where Email='$Email'");
$count1=mysqli_num_rows($que1);
if($count1>0)
{
echo "<script>
alert('There is an existing account associated with this email.');
</script>";
}
else
{
$Name=$_POST['first_name'].' '.$_POST['last_name'];
$Password=$_POST['password'];
$Gender=$_POST['sex'];
$Birthday_Date=$_POST['day'].'-'.$_POST['month'].'-'.$_POST['year'];
$saga_Join_Date=$_POST['saga_join_time'];
$campus=$_POST['campus'];
$county=$_POST['county'];
$day=intval($_POST['day']);
$month=intval($_POST['month']);
$year=intval($_POST['year']);
if(checkdate($day,$month,$year))
{
$que2=mysqli_query($connection,"insert into users(Name,Email,Password,Gender,Birthday_Date,saga_Join_Date,campus,county) values('$Name','$Email','$Password','$Gender','$Birthday_Date','$saga_Join_Date','$campus','$county')");
session_start();
$_SESSION['tempsagauser']=$Email;
if($Gender=="Male")
{
header("location:saga_files/saga_step/saga_step1/Step1_Male.php");
}
else
{
header("location:saga_files/saga_step/saga_step1/Step1_Female.php");
}
}
else
{
echo "<script>
alert('The selected date is not valid.');
</script>";
}
}
}
?>
最佳答案
确保表单
内有按钮
,并将其设置为type="submit"
。还要确保在您的登录表单中也进行更改。
<form method="post" name="registration_form" id='registration_form' class="form-inline" action="saga_files/saga_index_file/saga_SignUp_file/SignUp.php">
<div class="row">
<div class="form-group col-xs-6">
<label for="first_name" class="sr-only">First Name</label>
<input id="first_name" class="form-control input-group-lg" type="text" name="first_name" title="Enter first name" placeholder="First name"/>
</div>
<div class="form-group col-xs-6">
<label for="last_name" class="sr-only">Last Name</label>
<input id="last_name" class="form-control input-group-lg" type="text" name="last_name" title="Enter last name" placeholder="Last name"/>
</div>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="email" class="sr-only">Email</label>
<input id="email" class="form-control input-group-lg" type="text" name="email" title="Enter Email" placeholder="Your Email"/>
</div>
<div class="form-group col-xs-12">
<label for="remail" class="sr-only">Re-Enter Email</label>
<input id="remail" class="form-control input-group-lg" type="text" name="remail" title="Enter Email" placeholder="Re-Enter Your Email"/>
</div>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="password" class="sr-only">Password</label>
<input id="password" class="form-control input-group-lg" type="password" name="password" title="Enter password" placeholder="Password"/>
</div>
</div>
<div class="row">
<p class="birth"><strong>Date of Birth</strong></p>
<div class="form-group col-sm-3 col-xs-6">
<label for="month" class="sr-only"></label>
<select name="day" class="form-control" id="Day">
<option value="Day" disabled selected>Day</option>
<script type="text/javascript">
for(i=1;i<=31;i++)
{
document.write("<option value='"+i+"'>" + i + "</option>");
}
</script>
</select>
</div>
<div class="form-group col-sm-3 col-xs-6">
<label for="month" class="sr-only"></label>
<select name="month" class="form-control" id="Month">
<option value="Month" disabled selected>Month</option>
<script type="text/javascript">
var m=new Array("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
for(i=1;i<=m.length-1;i++)
{
document.write("<option value='"+i+"'>" + m[i] + "</option>");
}
</script>
</select>
</div>
<div class="form-group col-sm-6 col-xs-12">
<label for="year" class="sr-only"></label>
<select name="year" class="form-control" id="Year">
<option value="Year" disabled selected>Year</option>
<script type="text/javascript">
for(i=2000;i>=1960;i--)
{
document.write("<option value='"+i+"'>" + i + "</option>");
}
</script>
</select>
</div>
</div>
<div class="form-group gender">
<select name="sex" style="width:120;height:35;font-size:18px;padding:3;">
<option value="Select Sex:"> Select Sex: </option>
<option value="Female"> Female </option>
<option value="Male"> Male </option>
</select>
</div>
<div class="row">
<div class="form-group col-xs-6">
<label for="campus" class="sr-only">Campus</label>
<input id="campus" class="form-control input-group-lg reg_name" type="text" name="campus" title="Enter campus" placeholder="Your campus"/>
</div>
<div class="form-group col-xs-6">
<label for="county" class="sr-only"></label>
<select name="county" class="form-control" id="county">
<option value="county" disabled selected>County</option>
<option value="Baringo">Baringo</option>
<option value="Bomet">Bomet</option>
<option value="Bungoma">Bungoma</option>
<option value="Busia">Busia</option>
<option value="Elgeyo">Elgeyo Marakwet</option>
<option value="Embu">Embu</option>
<option value="Garissa">Garissa</option>
<option value="Homa">Homa Bay</option>
<option value="Isiolo">Isiolo</option>
<option value="Kajiado">Kajiado</option>
<option value="Kakamega">Kakamega</option>
<option value="Kericho">Kericho</option>
<option value="Kiambu">Kiambu</option>
<option value="Kilifi">Kilifi</option>
<option value="Kirinyaga">Kirinyaga</option>
<option value="Kisii">Kisii</option>
<option value="Kisumu">Kisumu</option>
<option value="Kitui">Kitui</option>
<option value="Kwale">Kwale</option>
<option value="Laikipia">Laikipia</option>
<option value="Lamu">Lamu</option>
<option value="Machakos">Machakos</option>
<option value="Makueni">Makueni</option>
<option value="Mandera">Mandera</option>
<option value="Meru">Meru</option>
<option value="Migori">Migori</option>
<option value="Marsabit">Marsabit</option>
<option value="Mombasa">Mombasa</option>
<option value="Muranga">Muranga</option>
<option value="Nairobi">Nairobi</option>
<option value="Nakuru">Nakuru</option>
<option value="Nandi">Nandi</option>
<option value="Narok">Narok</option>
<option value="Nyamira">Nyamira</option>
<option value="Nyandarua">Nyandarua</option>
<option value="Nyeri">Nyeri</option>
<option value="Samburu">Samburu</option>
<option value="Siaya">Siaya</option>
<option value="Taita">Taita Taveta</option>
<option value="Tana">Tana River</option>
<option value="Tharaka">Tharaka Nithi</option>
<option value="Trans">Trans Zoia</option>
<option value="Turkana">Turkana</option>
<option value="Uasin">Uasin Gishu</option>
<option value="Vihiga">Vihiga</option>
<option value="Wajir">Wajir</option>
<option value="West">West Pokot</option>
</select>
</div>
</div>
<button type="submit" name="signup" id="sign_button" class="btn btn-primary" / onClick="time_get()" >Register Now</button>
</form>
<input type="hidden" name="saga_join_time">
关于php - 单击按钮时方法发布不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44317752/
我想了解 Ruby 方法 methods() 是如何工作的。 我尝试使用“ruby 方法”在 Google 上搜索,但这不是我需要的。 我也看过 ruby-doc.org,但我没有找到这种方法。
Test 方法 对指定的字符串执行一个正则表达式搜索,并返回一个 Boolean 值指示是否找到匹配的模式。 object.Test(string) 参数 object 必选项。总是一个
Replace 方法 替换在正则表达式查找中找到的文本。 object.Replace(string1, string2) 参数 object 必选项。总是一个 RegExp 对象的名称。
Raise 方法 生成运行时错误 object.Raise(number, source, description, helpfile, helpcontext) 参数 object 应为
Execute 方法 对指定的字符串执行正则表达式搜索。 object.Execute(string) 参数 object 必选项。总是一个 RegExp 对象的名称。 string
Clear 方法 清除 Err 对象的所有属性设置。 object.Clear object 应为 Err 对象的名称。 说明 在错误处理后,使用 Clear 显式地清除 Err 对象。此
CopyFile 方法 将一个或多个文件从某位置复制到另一位置。 object.CopyFile source, destination[, overwrite] 参数 object 必选
Copy 方法 将指定的文件或文件夹从某位置复制到另一位置。 object.Copy destination[, overwrite] 参数 object 必选项。应为 File 或 F
Close 方法 关闭打开的 TextStream 文件。 object.Close object 应为 TextStream 对象的名称。 说明 下面例子举例说明如何使用 Close 方
BuildPath 方法 向现有路径后添加名称。 object.BuildPath(path, name) 参数 object 必选项。应为 FileSystemObject 对象的名称
GetFolder 方法 返回与指定的路径中某文件夹相应的 Folder 对象。 object.GetFolder(folderspec) 参数 object 必选项。应为 FileSy
GetFileName 方法 返回指定路径(不是指定驱动器路径部分)的最后一个文件或文件夹。 object.GetFileName(pathspec) 参数 object 必选项。应为
GetFile 方法 返回与指定路径中某文件相应的 File 对象。 object.GetFile(filespec) 参数 object 必选项。应为 FileSystemObject
GetExtensionName 方法 返回字符串,该字符串包含路径最后一个组成部分的扩展名。 object.GetExtensionName(path) 参数 object 必选项。应
GetDriveName 方法 返回包含指定路径中驱动器名的字符串。 object.GetDriveName(path) 参数 object 必选项。应为 FileSystemObjec
GetDrive 方法 返回与指定的路径中驱动器相对应的 Drive 对象。 object.GetDrive drivespec 参数 object 必选项。应为 FileSystemO
GetBaseName 方法 返回字符串,其中包含文件的基本名 (不带扩展名), 或者提供的路径说明中的文件夹。 object.GetBaseName(path) 参数 object 必
GetAbsolutePathName 方法 从提供的指定路径中返回完整且含义明确的路径。 object.GetAbsolutePathName(pathspec) 参数 object
FolderExists 方法 如果指定的文件夹存在,则返回 True;否则返回 False。 object.FolderExists(folderspec) 参数 object 必选项
FileExists 方法 如果指定的文件存在返回 True;否则返回 False。 object.FileExists(filespec) 参数 object 必选项。应为 FileS
我是一名优秀的程序员,十分优秀!