나는 간단한 PHP 등록 양식 (세부 사항은 아래 참조)을 업로드했습니다. & 완벽하게 작동합니다. 하지만 이제는 학생들이 "등록 번호"를 사용하여 등록을 확인할 수 있도록 검색 상자를 만들고 싶습니다. [Exp : http://www.nbceindia.in/student-verification.php] 나를 위해 코드를 작성하여 아무도 도와 줄 수 없습니까?Search MySql 데이터베이스 및 결과보기
미리 감사드립니다.
세부 사항 :
1 entry.php
<!DOCTTYPE html>
<head><link rel="stylesheet" type="text/css" href="style/style.css"></head>
<title>Registration</title>
<body>
<form name="form1" method="post" action="register_ac.php">
<li>Registration No.<input type="text" name="registration" class="#" id="registration" maxlength="8"/></li>
<li>First Name<input type="text" name="firstname" class="#" id="firstname"/></li>
<li>Surname<input type="text" name="surname" class="#" id="surname"/></li>
<li>Course Code<input type="text" name="course" class="#" iid="course" maxlength="7"/></li>
<li>Duration (Months)<input type="text" name="duration" class="#" id="duration"/></li>
<li>Mobile<input type="text" name="mobile" class="#" id="mobile" maxlength="10"/></li>
<li>Addressline1<input type="text" name="addressline1" class="#" id="addressline1"/></li>
<li>Addressline2<input type="text" name="addressline2" class="#" id="addressline2"/></li>
<li>City<input type="text" name="city" class="#" id="city"/></li>
<li>Postcode<input type="text" name="postcode" class="#" id="postcode" maxlength="6"/></li>
<input type="submit" id="textarea" name="submit" value="Submit" class="button"/>
</form>
</body>
</html>
2
<?php
$host="localhost"; // Host name
$username="username"; // Mysql username
$password="password"; // Mysql password
$db_name="database_name"; // Database name
$tbl_name="table_name"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Get values from form
$registration=$_POST['registration'];
$firstname=$_POST['firstname'];
$surname=$_POST['surname'];
$course=$_POST['course'];
$duration=$_POST['duration'];
$mobile=$_POST['mobile'];
$addressline1=$_POST['addressline1'];
$addressline2=$_POST['addressline2'];
$city=$_POST['city'];
$postcode=$_POST['postcode'];
// Insert data into mysql
$sql="INSERT INTO $tbl_name(registration, firstname, surname, course, duration, mobile, addressline1, addressline2, city, postcode)
VALUES('$registration', '$firstname','$surname','$course','$duration','$mobile','$addressline1','$addressline2','$city','$postcode')";
$result=mysql_query($sql);
// if successfully insert data into database, displays message "Successful".
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='index.php'>Back to main page</a>";
}
else {
echo "ERROR";
}
?>
<?php
// close connection
mysql_close();
?>
물론 같은 테이블 내부 출력을 - 여기에서 확인 코드입니다! '2a82a7042f264309859e585c4102a7a6' –
죄송합니다, 나는 그것을 –