-2
我得到這個錯誤: 注意:未定義的索引:性別\ form.php在第26.please help..how解決這個錯誤..?未定義的索引:
如何從形式員工性別男性或女性獲得並插入MySQL數據庫
**my html code**
<form action="form.php" method="post">
<table border="1">
<tr>
<td align="center">Form Input Employees Data</td>
</tr>
<tr>
<td>
<table>
<form method="post" action="form.php">
<tr>
<td>Name</td>
<td><input name="employe_name" type="text" id="employe_name" size="20">
</td>
</tr>
<tr>
<td>Address</td>
<td><input name="employe_add" type="text" id="employe_add" size="40">
</td>
</tr>
<tr>
<td height="23">Gender</td>
\t \t <td>Male<input type="radio" name="gender"value="m" />
\t \t Female<input type="radio" name="gender"value="f"/>
\t \t </td></tr>
\t \t
\t \t <td>
<td align="right"><input type="submit"
name="submit" value="Submit"> add</td>
</tr>
</table>
</td>
</tr>
</table></form>
而且 我的PHP代碼...
<?php
//Open a new connection to the MySQL server
$mysqli = new mysqli('localhost','root','','employe');
//Output any connection error
if ($mysqli->connect_error) {
die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
}else{
echo"connection good";
}
if(isset($_POST['gender']))
{
$gender=$_POST['gender'];
echo("your are select" .$gender);
}
//get values from form
$employe_name=$_POST['employe_name'];
$employe_add=$_POST['employe_add'];
$gender=$_POST['gender'];
//insert data into mysql
$sql = "INSERT INTO employe_detail(employe_name,employe_add,gender) VALUES('$employe_name','$employe_add','$gender')";
print '<h3>Insert a record</h3>';
if($sql)
{
print 'Success! ID of last inserted record is : ' .$mysqli->insert_id .'<br />';
}else{
die('Error : ('. $mysqli->errno .') '. $mysqli->error);
}
$mysqli->close();
?>
請幫我............
嵌套表格,你也不能查詢 –