我有一个通过 php 在循环中创建的表单
是这样的
<?php
$number = count($name_array);
$id = 0;
while($id<$number)
{
if($category[$id] == ewbp)
{
$ewbp = 'selected';
}
if($category[$id] == iwbp)
{
$iwbp = 'selected';
}
if($category[$id] == wbe)
{
$wbe = 'selected';
}
if($category[$id] == texture)
{
$texture = 'selected';
}
if($category[$id] == putties)
{
$putties = 'selected';
}
if($category[$id] == primer)
{
$primer = 'selected';
}
echo "
<div class=\"update_form_holder\">
<form action=\"processor/update.php\" enctype=\"multipart/form-data\" method=\"post\">
<table>
<tr>
<td>Name</td><td><textarea rows=\"1\" cols=\"30\" name=\"name\">"."$name_array[$id]"."</textarea></td>
</tr>
<tr>
<td>Small Description</td><td><textarea rows=\"2\" cols=\"60\" name=\"short_desription\">"."$short_description[$id] "."</textarea></td>
</tr>
<tr>
<td>Full Description</td><td><textarea rows=\"5\" cols=\"60\" name=\"long_description\">"."$long_description[$id]"."</textarea></td>
</tr>
<tr>
<td>Category</td>
<td>
<select name=\"category\">
<option value=\"ewbp\" ". "$ewbp" . ">Exterior Water Based Paints </option>
<option value=\"iwbp\" ". "$iwbp" . ">Interior Water Based Paints</option>
<option value=\"wbe\" ". "$wbe" . ">Water Based Enamel </option>
<option value=\"texture\" ". "$texture" . ">Textures</option>
<option value=\"putties\" ". "$putties" . ">Putties</option>
<option value=\"primer\" ". "$primer" . ">Premir</option>
</select>
</td>
</tr>
<tr>
<td><input type=\"hidden\" value=\""."$idi[$id]"."\" name=\"idi\"></td>
</tr>
<tr>
<td><input type=\"submit\" value=\"update\"></td>
</tr>
</table>
</form>
</div>
<div class=\"image_holder\">
<img src=\""."$imgurl[$id]"."\" />
</div>
<form action=\"processor/delete.php\" method=\"post\">
<input type=\"hidden\" value=\"$idi[$id]\" name=\"delete_id\">
<input type=\"hidden\" value=\"$filename[$id]\" name=\"delete_file\">
<input type=\"submit\" value=\"delete entry\" >
</form>
";
$id++;
$ewbp = '';
$iwbp = '';
$wbe = '';
$texture = '';
$putties = '';
$primer = '';
}
?>
我试图让 textareas 使用 ckeditor,问题是,它需要不同的名称来创建新实例,但是我无法更改名称,因为数据被提交到另一个 php 文件以存储在 sql 数据库中。有没有办法让它创建更多实例而无需更改名称?我尝试使用 ID,但它不起作用。此外,这个链接让我怀疑它是否可能。