我有一个 div,里面有一段 php 代码
我需要复制 div 和 php,我该怎么做?
克隆方法显然不适用于 php ,仅克隆 div 而没有 php 代码。
<div id="wrap" style="margin: 80px;">
<p>
<label>Área profissional :</label> <select name="area" class="area">
<option selected="selected">Seleccione a Área</option>
<?php
$sql=mysql_query("select id_formation_area, area from formation_area");
while($row=mysql_fetch_array($sql)){
$area=$row['area'];
$id_area=$row['id_formation_area'];
echo '<option value='.$id_area.'>'.$area.'</option>';
}
?>
</select> <label>Profissão:</label> <select name="profissao"
class="profissao">
<option selected="selected">Seleccione a profissão</option>
</select> <label>Gráfico:</label> <select name="estatistica"
class="estatistica">
<option selected="selected">Seleccione a estatistica</option>
</select> <span class="remove">Remove</span>
</p>
<p>
<span class="add">Add fields</span>
</p>
</div>
最佳答案
- 您不能使用客户端技术(没有 ajax 支持)来克隆服务器端代码
- 看来你的 mysql 查询如果你再次查询它不会返回不同的结果,这意味着(第 3 点)
- 由于您的 PHP 代码正在生成 HTML 输出,因此克隆输出相当于“再次输出整个内容”!
关于php - 克隆问题 - jquery/php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5968627/