我无法将值插入到数据库中。但是我也没有收到任何错误消息。
<html>
<body>
<form action="database.php" method="post">
Name : <input type ="text" name = "name"/>
Number :<input type ="text" name = "number"/>
<input type ="submit" value = "submit"/>
</form>
</body>
</html>
数据库.php
<?php
class Database
{
var $host;
var $user;
var $pass;
var $data;
var $con;
var $table;
var $db;
public function controls()
{
$this->host="localhost";
$this->user="cgiadmin";
$this->pass="cgi";
$this->data="j2";
}
public function connection()
{
$this->con="mysql_connect($this->host,$this->user,$this->pass)";
}
public function tablename()
{
$this->table="Insert into employee(name,number) values('$_POST[name]','$_POST[number]')";
}
public function databaseconnection()
{
$this->db="mysql_select_db($this->data,$this->con)";
}
}
$name=new Database;
$name->connection();
if(!($name->con))
{
echo "'Error: ' . mysql_error()";
}
$name->databaseconnection();
$name->tablename();
echo "thanks for taking the survey";
?>