01.
function
chkString(
$strText
)
02.
{
03.
return
$strText
;
04.
}
05.
06.
function
checkInt(
$intText
)
07.
{
08.
return
$intText
;
09.
}
10.
11.
$result
= mysql_query(
"SELECT MAX(apply_id) AS max_id FROM apply"
);
12.
$row
= mysql_fetch_assoc(
$result
);
13.
14.
$temp_year
=
substr
(
$row
[
'max_id'
], 0, 2);
15.
$nowyear
= (
date
(
"y"
)+43);
16.
$auto_id
= (
$nowyear
==
$temp_year
) ?
''
: (
$nowyear
) .
"000001"
;
17.
18.
$copy_of_ID_registration
= (
$_POST
[
'copy_of_ID_registration'
]) ?
'1'
:
'0'
;
19.
$copy_of_ID_card
= (
$_POST
[
'copy_of_ID_card'
]) ?
'1'
:
'0'
;
20.
$proxy
= (
$_POST
[
'proxy'
]) ?
'1'
:
'0'
;
21.
$document_other
= (
$_POST
[
'document_other'
]) ?
'1'
:
'0'
;
22.
23.
mysql_query("INSERT INTO `apply` (
24.
`apply_id`,
25.
`install_kind`,
26.
`use_kind_id`,
27.
`req_gender`,
28.
`req_name`,
29.
`req_address`,
30.
`req_phone`,
31.
`req_use_gender`,
32.
`req_use_name`,
33.
`req_use_cid`,
34.
`req_use_address`,
35.
`req_use_phone`,
36.
`discount_warter_use`,
37.
`discount_warter_use_unit`,
38.
`copy_of_ID_registration`,
39.
`copy_of_ID_card`,
40.
`proxy`,
41.
`document_other`,
42.
`document_other_detail`,
43.
`size_meter`,
44.
`meter_price`,
45.
`insurance_meter_price`,
46.
`req_date`
47.
)
48.
VALUES (
49.
'".chkString($auto_id)."'
,
50.
'" . checkInt($_POST['
install_kind
']) . "'
,
51.
'" . checkInt($_POST['
use_kind_id
']) . "'
,
52.
'" . chkString($_POST['
req_gender
']) . "'
,
53.
'" . chkString(trim($_POST['
req_name
'])) ."'
,
54.
'" . trim($_POST['
req_address
']) . "'
,
55.
'" . trim($_POST['
req_phone
']) . "'
,
56.
'" . $_POST['
req_use_gender
'] . "'
,
57.
'" . trim($_POST['
req_use_name
']) ."'
,
58.
'" . $_POST['
req_use_cid
'] . "'
,
59.
'" . trim($_POST['
req_use_address
']) . "'
,
60.
'" . trim($_POST['
req_use_phone
']) . "'
,
61.
'" . $_POST['
discount_warter_use
'] . "'
,
62.
'" . $_POST['
discount_warter_use_amount
'] . "'
,
63.
'" . $copy_of_ID_registration . "'
,
64.
'" . $copy_of_ID_card . "'
,
65.
'" . $proxy . "'
,
66.
'" . $document_other . "'
,
67.
'" . trim($_POST['
document_other_detail
']) . "'
,
68.
'" . $_POST['
size_meter
'] . "'
,
69.
'" . trim($_POST['
meter_price
']) . "'
,
70.
'" . trim($_POST['
insurance_meter_price
']) . "'
,
71.
72.
NOW());"
73.
)
or
die
(mysql_error());