我刚刚从共享主机转移到专用主机,突然 POST 无法正常工作。变量正在根据萤火虫发送
jquery....min.js (line 4)
HeadersPostResponseHTML
Parametersapplication/x-www-form-urlencoded
current_subtab_1 0
current_tab_1 0
delivery_options Standard (5 working days)
new_copies 1500
p_binding Portrait
p_colours_fs Full Colour. (CMYK Process)
p_colours_fs_c No Lamination
p_colours_t Full Colour. (CMYK Process)
p_copies 1000
p_cover Self Cover
p_cover_c Silk
p_format A4 (Portrait Only)
p_pages 8
p_paper 130 GSM, coated
p_paper_type Silk
Source
current_tab_1=0¤t_subtab_1=0&delivery_options=Standard+(5+working+days)& p_copies=1000&p_paper=130+GSM%2C+coated&p_paper_type=Silk&p_colours_t=Full+Colour.+(CMYK+Process)&p_pages=8&p_binding=Portrait&p_format=A4+(Portrait+Only)&p_cover=Self+Cover
但是当我在服务器端打开错误报告时,它说所有变量都是未定义的。是的,它们的定义正确,并且脚本之前运行良好......
<br />
<b>Notice</b>: Undefined index: current_tab_1 in <b>calculate.php</b> on line <b>6</b><br />
<br />
<b>Notice</b>: Undefined index: current_tab_1 in <b>calculate.php</b> on line <b>215</b><br />
<br />
<b>Notice</b>: Undefined index: current_subtab_1 in <b>calculate.php</b> on line <b>216</b><br />
<br />
<b>Notice</b>: Undefined index: p_format in <b>calculate.php</b> on line <b>220</b><br />
ETC
那么它为什么要这样做呢?有什么我需要更改的(一个 php.ini,配置)设置吗?一定是PHP的东西
更新:
我做了一个print_r($_POST);
看看是否有任何东西被发布,它返回了一个空数组
编辑:
客户端
if (current_tab == 0) {
if (current_subtab == 0) {
if ($("#saddle_brochure_copies").val() != "Please select...") {
if ($("#saddle_brochure_copies").val().match('^(0|[1-9][0-9]*)$')) {
if ($("#saddle_brochure_copies").val() != 25000) {
var new_copies = $('#saddle_brochure_copies option:selected').next().val(); //get next selected option for offer price
}
var p_copies = $("#saddle_brochure_copies"),
p_paper = $("#saddle_brochure_paper"),
p_paper_type = $("#saddle_brochure_paper_type"),
p_colours_t = $("#saddle_brochure_colours_t"),
p_pages = $("#saddle_brochure_pages"),
p_binding = $("#saddle_brochure_binding"),
p_format = $("#saddle_brochure_format"),
p_cover = $("#saddle_brochure_cover"),
p_cover_c = $("#saddle_brochure_cover_c"),
p_colours_fs = $("#saddle_brochure_colours_fs"),
p_colours_fs_c = $("#saddle_brochure_colours_fs_c"),
allFields = $([]).add(p_copies).add(p_paper).add(p_paper_type).add(p_colours_t).add(p_pages).
add(p_binding).add(p_format).add(p_cover).add(p_cover_c).add(p_colours_fs).add(p_colours_fs_c),
tips = $(".validateTips");
$.post("order/calculate.php", {
current_tab_1: current_tab,
current_subtab_1: current_subtab,
delivery_options: delivery_options.val(),
p_copies: p_copies.val(),
p_paper: p_paper.val(),
p_paper_type: p_paper_type.val(),
p_colours_t: p_colours_t.val(),
p_pages: p_pages.val(),
p_binding: p_binding.val(),
p_format: p_format.val(),
p_cover: p_cover.val(),
p_cover_c: p_cover_c.val(),
p_colours_fs: p_colours_fs.val(),
p_colours_fs_c: p_colours_fs_c.val(),
new_copies: new_copies
}, function (data) {
var resultArray = eval('(' + data + ')');
checkIfNull();
$(".value_2").append("£");
if ($("#hf_quote").val() != null) {
$("#hf_quote").val(null);
}
$("#hf_quote").val(resultArray[0]);
if ($("#hf_vat").val() != null) {
$("#hf_vat").val(null);
}
$("#hf_vat").val(resultArray[1]);
cashFlow($('.value'), 0, resultArray[0], 1 * 1000, 0);
if (resultArray[1] != "No VAT on this product!") {
$("#quote_vat").append("£", resultArray[1], " Inc. VAT");
} else {
$("#quote_vat").append(resultArray[1]);
}
if (resultArray[2]) {
if ($("#quote_offer").text() != null) {
$("#quote_offer").text("");
}
$("#quote_offer").append("Get ", new_copies, " copies for £", resultArray[2]);
}
});
print_r($_REQUEST); 回报 -
Array (
[ppRemember] => 35iq0m8oi3ldr1f8603sifpv52 [__utma] => 201771013.995365705.1339148067.1339148067.1339155188.2 [__utmc] => 201771013 [__utmz] => 201771013.1339148067.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) [__utmb] => 201771013.9.10.1339155188
)
print_r($_GET);
返回空数组
有问题的服务器端代码
if ($_POST['current_tab_1']==0) {
if ($_POST['current_subtab_1']==0) {
//for saddle stitched brochures
//cost 1
$format = strip_tags(substr($_POST['p_format'],0,100)); //format
$B = strip_tags(substr($_POST['p_copies'],0,10)); //copies
$C1 = strip_tags(substr($_POST['p_paper'],0,100)); //paper inner pages
$C2 = strip_tags(substr($_POST['p_cover'],0,100));
$lamination = strip_tags(substr($_POST['p_colours_fs_c'],0,100)); //lamination
$P = strip_tags(substr($_POST['p_pages'],0,100));
$new_copies = strip_tags(substr($_POST['new_copies'],0,100));
}
}
更新:
我试过 echo $_POST['current_tab_1']; 就在脚本的顶部,它返回了一个未定义的错误。
还注意到其中一个错误是......?
致命错误:在第975行的calculate.php中调用未定义函数 json_encode()
这是一个内置功能..对吗?