Twitter引导模式,不使用php发布到mysql
大家好,我正试图让我的第一个模式做一个注册页面,以便它发布用户信息到mysql。我已经尝试了一段时间,似乎找不到我的错误,非常感谢您的帮助! 模态Twitter引导模式,不使用php发布到mysql,php,Php,大家好,我正试图让我的第一个模式做一个注册页面,以便它发布用户信息到mysql。我已经尝试了一段时间,似乎找不到我的错误,非常感谢您的帮助! 模态 <div id="myModalRegister" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-head
<div id="myModalRegister" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Register</h3>
</div>
<div class="modal-body">
<form id="modal-form" class="form-horizontal" action="register.php" onSubmit="return validateFormReg();" name="formregister">
<div class="control-group">
<label class="control-label" for="inputEmail">Email</label>
<div class="controls">
<input type="text" id="inputEmail" name="email" placeholder="Email">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword" >Password</label>
<div class="controls">
<input type="password" id="inputPassword" name="pwd" placeholder="Password">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword" >Password</label>
<div class="controls">
<input type="password" id="inputPassword" name="pwd1" placeholder="Retype Password">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">School</label>
<div class="controls">
<?php
$query = sprintf("SELECT * FROM university");
$result = @mysql_query($query);
$rowModel = mysql_fetch_array($result);
?>
<select name="university" id="university">
<option value="">Select University</option>
<?php do { ?>
<option value="<?php echo $rowModel['university_id']; ?>"><?php echo $rowModel['name']; ?></option>
<?php }while ($rowModel = mysql_fetch_array($result)); ?>
</select>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="checkbox" id="checky" name="checkbox"> I agree to the <a href="Terms.php" target="_blank">Terms of Service</a> and the <a href="Privacy.php" target="_blank">Privacy Policy</a><br><br><p>
<input type="submit" id="modal-form-submit" name="submit" value="Submit" class="btn btn-success" onclick="if(!this.form.checkbox.checked){alert('You must agree to the terms first.');return false}" />
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">Close</button>
</div>
</div>
&时代;
登记
电子邮件
密码
密码
学校
选择大学
我同意和
接近
这里是PHP发布端
<?php
include_once('inc/db.php');
$tbl_name="user"; // Table name
$email = $_POST['email'];
$password = $_POST['pwd'];
$uni = $_POST['university'];
$password = md5($password);
$email = stripslashes($email);
$password = stripslashes($password);
$uni = stripslashes($un
i);
$email = mysql_real_escape_string($email);
$password = mysql_real_escape_string($password);
$uni = mysql_real_escape_string($uni);
$sql_insert = "INSERT INTO $tbl_name(email , password, university_id) VALUES('$email', '$university_id', '$password')";
$result_insert = mysql_query($sql_insert) or die(mysql_error());
?>
<html>
<head>
<?php echo $uni?>
<?php echo $email?>
SEND TO PAGE
</head>
</html>
不要放在头标签里,用身体标签
改变
<html>
<head>
<?php echo $uni?>
<?php echo $email?>
SEND TO PAGE
</head>
</html>
发送到第页
到
发送到第页
嘿,对不起,我解决了我的问题。。
首先,在我的模态中,我没有方法“post”,在sql中,我让pwd进入uni-id,uni-id进入pwd。现在一切都好了 在body中使用php标记,而不是在html head标记中使用。谢谢,我试过了,但似乎我插入uni的变量、电子邮件和密码并没有从表单中转移过来。我做了你的改变,它是空白的,只是说发送到页面上的页面
<html>
<body>
<?php echo $uni; ?>
<?php echo $email; ?>
SEND TO PAGE
</body>
</html>