克隆表单的php输出为纯文本

I'm trying to clone some html using jquery.

It's working fine but the php it clone is being output as plain text.

Any ideas how I can change this?

Here's a jsfiddle of what i've got so far http://jsfiddle.net/vs8p5/5/

Here's the jquery

function updateClonedInput(index, element) {
$(element).appendTo("body").attr("id", "clonedInput" +  index);
$(element).find(">:first-child").attr("id", "show_upload_image_link_" + index);
$(element).find(">:first-child").attr("name", "kandibox_theme_hero_options[show_upload_image_link_" + index + "]");
$(element).find(">:first-child").attr("value", "<?php echo $hero_options['show_upload_image_link_" + index + "']; ?>");
$(element).find(">:first-child").next().attr("id", "show_upload_image_link_button_" + index);
}

$(document).on("click", "button.clone", function(){
var cloneIndex = $(".clonedInput").length + 1;
var new_Input = $(this).parents(".clonedInput").clone();
updateClonedInput(cloneIndex, new_Input);    
});
$(document).on("click", "button.remove", function(){
$(this).parents(".clonedInput").remove();

$(".clonedInput").each( function (cloneIndex, clonedElement) {
updateClonedInput(cloneIndex + 1, clonedElement);
})
});

Here's the html form

<div id="upload_image_sets">
  <div id="clonedInput1" class="clonedInput">
  <input type="text" size="36" name="hero_options[upload_image_link_1]" value="<?php echo $hero_options['upload_image_link_1']; ?>" /> 
  <input id="show_upload_image_link_button_1" class="button upload_images" type="button" value="Upload Image" />
    <div class="actions">
      <button class="clone">Clone</button> 
      <button class="remove">Remove</button>
    </div>
  </div>
</div>

In order to output like php remove the "" around the php code:

 $(element).find(">:first-child").attr("value", <?php echo $hero_options['show_upload_image_link_" + index + "']; ?>);

Otherwise it does not read the actual php, it automatically converts it to HTML text.

I also noticed that you are inserting jquery between the php code. You will have to close the code before outputting jquery. If the above still works incorrectly. This should do the trick:

$(element).find(">:first-child").attr("value", <?php echo $hero_options['show_upload_image_link_?>index<?php ']; ?>);

Hope this helps!