dear everyone,
I can not make it work to input data into mysql from the browser.
Can anyone help?
Since I can not input data in Chinese from GNOME terminal, I am trying to input data in Chinese from a browser. Following is my code
<?php
include '/wwwroot/include/wanlidi/error.php/';
include '/wwwroot/include/wanlidi/incdsr.php/';
include '/wwwroot/include/wanlidi/clean.php/';
if (empty($Id_Address) || empty($AddressHead))
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>��ַ����</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../rz/rase.css" type="text/css" media="all" media="handheld" />
<style type="text/css" media="all" media="handheld">
@import url"../rz/rase.css";
</style>
</head>
<body>
<form action="addinput.php" method="post">
������:
<input type="text" name="Id_Address" size="3">
<input type="text" name="AddressHead" size="30">
<input type="text" name="TelephoneHead" size="4">
<input type="submit" value="�ύ">
</form>
</body>
</html>
<?php
}
else
{
$Id_Address = clean($Id_Address, 3);
$AddressHead = clean($AddressHead, 30);
$TelephoneHead = clean($TelephoneHead, 4);
if (!($connection = @ mysql_connect($hostName,$username,$password)))
die("����l�ӵ���ݿ�");
if(!(@ mysql_select_db($databaseName, $connection)))
showerror();
$insertQuery = "insert into addhd values
(\"" . $Id_Address . "\", " .
"\"" . $AddressHead . "\", " .
"\"" . $TelephoneHead . "\")";
if ((@ mysql_query ($insertQuery, $connection))
&& @ mysql_affected_rows() == 1)
header("location: input_header.php?" .
"Id_Address= " . mysql_insert_id($connection) .
"&status=T");
else
header("location: input_header.php?" .
"&status=F");
}
?>
<?php include '/wwwroot/include/wanlidi/error.php/';
include '/wwwroot/include/wanlidi/incdsr.php/';
include '/wwwroot/include/wanlidi/clean.php/';
$Id_Address = clean($Id_Address, 3);
$status = clean($status, 1);
switch ($status)
{
case "T":
$query = "select * from addhd where " . "id = $Id_Address";
if (!($connection = @ mysql_connect($hostName,$username,$password)))
die("不能连接到数据库");
if (!(@ mysql_select_db($databaseName, $connection))) showerror();
if (!($result = @ mysql_query($query, $connection))) showerror();
if ($row = @ mysql_fetch_array($result))
{ echo "添加了下述地区";
echo "\n
地区代号: " .
"$row["id"];
echo "\n
地区: " . "$row["addhead"];
echo "\n
区号: " . "$row["telehead"]; }
break;
case "F":
echo "输入地区操作失败!";
echo "请联系系统管理员.";
break;
default:
echo "你意外地见到这一网页.";
}
?>