ในฐานข้อมูลมันเพิ่มอันนี้ลงไปอะครับ มือใหม่จริงๆ หัดเขียนดูแต่ ผมผิดพลาดตรงไหนหว่า :'(
txt_user txt_pass txt_name txt_address
อันนี้โค้ดครับ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
include ('../includes/config.php');
if($_POST[button] == 'Submit'){
$txt_user = $_POST[txt_user];
$txt_pass = $_POST[txt_pass];
$txt_name = $_POST[txt_name];
$txt_address = $_POST[txt_address];
$txt_phone = $_POST[txt_phone];
$query = "INSERT INTO tbl_member (username,password,name,address,phone) values ('txt_user','txt_pass','txt_name','txt_address','txt_phone')";
$result = mysql_db_query($dbname,$query);
if ($result) {
echo "เรียบร้อย";
}else{
echo "ผิดพลาด";
}
}
?>
<form id="form1" name="form1" method="post" action="">
<p>
username
<label for="txt_user"></label>
<input type="text" name="txt_user" id="txt_user" />
</p>
<p>
password
<input type="text" name="txt_pass" id="txt_pass" />
</p>
<p>
name
<input type="text" name="txt_name" id="txt_name" />
</p>
<p>
address
<label for="txt_address"></label>
<textarea name="txt_address" id="txt_address" cols="45" rows="5"></textarea>
</p>
<p>
phone
<input type="text" name="txt_phone" id="txt_phone" />
</p>
<p>
<input type="submit" name="button" id="button" value="Submit" />
</p>
</form>
</body>
</html>