オンラインまたは検索機能でこれに対する答えが見つからなかったので、投稿することにしました。
他のフォームと同様に、CodeIgniter内のAJAXコントローラーに投稿されているフォームがあります。次のコードは、投稿されているより大きなフォームの一部です。
<tr>
<td><label class="checkbox"><input type="checkbox" name="ef1_active" value="1"></label></td>
<td><input type="text" name="ef1_label" value=""></td>
<td><select name="ef1_clang" class="input-small">'.$optionlist.'</select></td>
<td><label class="checkbox"><input type="checkbox" name="ef1_required" value="1"></label></td>
</tr>
<tr>
<td><label class="checkbox"><input type="checkbox" name="ef2_active" value="1"></label></td>
<td><input type="text" name="ef2_label" value=""></td>
<td><select name="ef2_clang" class="input-small">'.$optionlist.'</select></td>
<td><label class="checkbox"><input type="checkbox" name="ef2_required" value="1"></label></td>
</tr>
<tr>
<td><label class="checkbox"><input type="checkbox" name="ef3_active" value="1"></label></td>
<td><input type="text" name="ef3_label" value=""></td>
<td><select name="ef3_clang" class="input-small">'.$optionlist.'</select></td>
<td><label class="checkbox"><input type="checkbox" name="ef3_required" value="1"></label></td>
</tr>
<tr>
<td><label class="checkbox"><input type="checkbox" name="ef4_active" value="1"></label></td>
<td><input type="text" name="ef4_label" value=""></td>
<td><select name="ef4_clang" class="input-small">'.$optionlist.'</select></td>
<td><label class="checkbox"><input type="checkbox" name="ef4_required" value="1"></label></td>
</tr>
フォームはシリアル化されており、次のコードで保存するためにajaxにプッシュされています。
var data = {
content : content,
property : property,
data_type : dataType,
form_id : $('#form_id').val()
};
$.ajax({
type: 'POST',
url: url,
data: data,
dataType: 'json',
success: function (result)
{
if(result.html == 'deleted')
{
window.location.reload();
}
else
{
$('#newForm').html('');
}
}
});
console.loggedの場合の「content」変数のシリアル化された結果:
firstname=1&firstname_required=1&prefix=1&lastname=1&lastname_required=1&homePhone=1&homePhone_required=1&emailAddress=1&emailAddress_required=1&ef1_label=&ef1_clang=Code&ef2_label=&ef2_clang=Code&ef3_label=&ef3_clang=Code&ef4_label=&ef4_clang=Code
しかし、PHPでエコーアウトすると、次のようになります。
firstname=1&firstname_required=1&prefix=1&lastname=1&lastname_required=1&homePhone=1&homePhone_required=1&emailAddress=1&emailAddress_required=1&ef1;_label=&ef1_clang=Code&ef2;_label=&ef2_clang=Code&ef3;_label=&ef3_clang=Code&ef4;_label=&ef4_clang=Code
;
すべての変数に追加されていることに注意してください_label
...変数の名前を変更したり、フォームの上に配置したりしてみました...何も機能しません。PHPは;
、これらのテキストフィールドにを追加し続けます。
コントローラーをこれまで取り除いた:
public function save_form_content()
{
print_r($_POST['content']); exit;
}
誰かアイデアがありますか?
前もって感謝します!