0
這是我的全編碼,未定義的索引錯誤,我該如何解決這個問題?
<?php
如果(isset($ _ POST [ '提交'])){
$用戶名= $ _ POST [ '用戶名']; $ password = $ _POST ['password'];
if($username && $password){
$insert = mysql_query("INSERT INTO users VALUES('', '$username', '$password')");
$msg = "User is created successfully";
}
else{
$error = "Please fillup all required fields!";
}
}出現 >
<form class="form-horizontal" action="settings_user.php" method="POST">
<div class="form-group"><label class="col-lg-2 control-label">User Name</label>
<div class="col-lg-4"><input type="text" name="username" placeholder="" class="form-control" autofocus>
</div>
</div>
<div class="form-group"><label class="col-lg-2 control-label">Password</label>
<div class="col-lg-4"><input type="password" name="password" placeholder="" class="form-control"></div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-sm btn-primary" name="submit" type="submit">ADD</button>
</div>
</div>
<?php echo $msg; ?>
<?php echo $error; ?>
</form>
的兩個錯誤消息:?我該如何解決這個未定義指數$味精和$錯誤
?
是的,它應該會出現,因爲變量$ msg和$ error只會在表單提交的時候被定義! – 2014-09-25 04:16:01