テーブルの各行にループwhileループを使用して、行の値をモーダルフォームに渡しています。php変数の値が大きい場合はモーダルが開きません
<td><a class="custom-links" onclick='EditModal("<?php echo $data['id']; ?>","<?php echo $data['name']; ?>","<?php echo $data['price']; ?>","<?php echo $data['description']; ?>","<?php echo $data['type']; ?>","<?php echo $data['cooking_instructions']; ?>","<?php echo $data['ingredients']; ?>","<?php echo $data['allergen_warnings']; ?>","<?php echo $data['storage_instructions']; ?>","<?php echo $data['case_size']; ?>","<?php echo 'uploaded_images/'.$data['image']; ?>")'>
<button type="button" id="<?php echo $data['id']; ?>" class='btn btn-primary glyphicon glyphicon-edit'></button></a></td>
その後、私は
function EditModal(id,name,price,description,type,cooking_instructions,ingredients,allergen_warnings,storage_instructions,case_size,image){
document.getElementById("update_id").value = id;
document.getElementById("update_name").value = name;
document.getElementById("update_price").value = price;
document.getElementById("update_description").value = description;
document.getElementById("update_type").value = type;
document.getElementById("update_cooking_instructions").value = cooking_instructions;
document.getElementById("update_ingredients").value = ingredients;
document.getElementById("update_allergen_warnings").value = allergen_warnings;
document.getElementById("update_storage_instructions").value = storage_instructions;
document.getElementById("update_case_size").value = case_size;
document.getElementById("update_image_to_upload").src = image;
$('#update_menu_modal').modal('show');}
update_cooking_instructions、update_ingredientsのような値を設定し、update_allergen_warningsはテキストエリアです。
$data['cooking_instructions'], $data['ingredients'], $data['allergen_warnings']
の語数が少ない場合、またはEditModal
の機能から除外し、その値が大きい場合はモーダルが開かれない場合にモーダルが開かれるという問題があります。
誰かが間違いを指摘できますか?私は間違って何をしていますか?私は二重引用符を削除した
<td><a class="custom-links" onclick='EditModal(<?php echo json_encode($data['id']); ?>,<?php echo json_encode($data['name']); ?>,<?php echo json_encode($data['price']); ?>,<?php echo json_encode($data['description']); ?>,<?php echo json_encode($data['type']); ?>,<?php echo json_encode($data['cooking_instructions']); ?>,<?php echo json_encode($data['ingredients']); ?>,<?php echo json_encode($data['allergen_warnings']); ?>,<?php echo json_encode($data['storage_instructions']); ?>,<?php echo json_encode($data['case_size']); ?>,<?php echo json_encode('uploaded_images/'.$data['image']); ?>)'>
<button type="button" id=<?php echo json_encode($data['id']); ?> class='btn btn-primary glyphicon glyphicon-edit'></button></a></td>
:私はあなたがまだ単一引用符に問題があるでしょうノートものの、この試してみてEditModal
'update_cooking_instructions'、' update_ingredients'、 'update_allergen_warnings'は' textareas'ですか? – smarx
ブラウザのコンソールにエラーがありますか? – smarx
大きな値に引用符や改行が含まれていますか? – smarx