我有我想要的表格;你能帮我在数据库中插入发送的数据吗?这是jsfiddle.net/AbuNidal/Rqt5u/9我的process_form.php
形式<?php
$title=$_POST['title'];
$catid=$_POST['catid'];
$published='1';
$introtext=$_POST['text'];
$created='155';
$access='1';
$language='*';
$publish_down='0000-00-00 00:00:00';
$language=$_POST['[{"id":"4","value":"$_POST['K2ExtraField_4']"},{"id":"6","value":"$_POST['K2ExtraField_6']"},{"id":"12","value":"$_POST['K2ExtraField_12']"},{"id":"13","value":"$_POST['K2ExtraField_13']"},{"id":"7","value":"$_POST['K2ExtraField_7']"},{"id":"8","value":"$_POST['K2ExtraField_8']"},{"id":"9","value":"K2ExtraField_9"},{"id":"1","value":"K2ExtraField_1"},{"id":"2","value":"K2ExtraField_2"},{"id":"3","value":"K2ExtraField_3"},{"id":"5","value":"K2ExtraField_5"},{"id":"10","value":["","http:\/\/$_POST['K2ExtraField_10']","new"]},{"id":"11","value":["","http:\/\/$_POST['K2ExtraField_11']","new"]}]'];
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("form", $con);
$query("INSERT INTO y2ium_items ( title, catid, published, introtext, extra_fields, created, publish_down, access, language)
VALUES (null,'$title',$catid,$published,'$introtext','$extra_fields',$created,$publish_down,$access,$language)");
$result=mysql_query($query,$con);
mysql_close($con);
?>
谢谢
答案 0 :(得分:0)
这一位:
[{"id":"4","value":"$_POST['K2ExtraField_4']"},{"id":"6","value":"$_POST['K2ExtraField_6']"},{"id":"12","value":"$_POST['K2ExtraField_12']"},{"id":"13","value":"$_POST['K2ExtraField_13']"},{"id":"7","value":"$_POST['K2ExtraField_7']"},{"id":"8","value":"$_POST['K2ExtraField_8']"},{"id":"9","value":"K2ExtraField_9"},{"id":"1","value":"K2ExtraField_1"},{"id":"2","value":"K2ExtraField_2"},{"id":"3","value":"K2ExtraField_3"},{"id":"5","value":"K2ExtraField_5"},{"id":"10","value":["","http:\/\/$_POST['K2ExtraField_10']","new"]},{"id":"11","value":["","http:\/\/$_POST['K2ExtraField_11']","new"]}]
看起来像JSON。尝试使用json_decode。这应该让你去。并且不要使用mysql_ *函数,如上面的注释中所述。 http://php.net/manual/en/function.json-decode.php