大家好,我想讓我的第一個模式做一個註冊頁面,以便它將用戶信息發佈到MySQL。我一直在嘗試這一段時間,似乎無法找到我的錯誤,很多幫助將不勝感激! MODALTwitter Bootstrap莫代爾,而不是發佈到MySQL與PHP
<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>
在身體使用php標記,而不是在html頭標記 – 2013-05-05 02:26:27