How to render the same field twice but with different name/id attribute? I have overriden user-register.tpl.php and in it I would like to render same checkbox twice (so that I can submit if either of them have been checked and they are the same I just need to display them twice).

Example:

&lt;div class='field1'&gt;
   print render($form['field_add_option']);
&lt;/div&gt;
&lt;div class='field2'&gt;
   print render($form['field_add_option']);
&lt;/div&gt;


But this gives same field with same id with same name which is to be expected. Is there a way to change name and id of field before rendering?

I have tried to change the name like (before the second one)
$form['field_add_option']['und']['#name'] = 'test1';

But the label for and name of checkbox are still the same.
The select element don't have #name atribute (Form API Reference). You can implement the hook_form_alter() in a custom module.

/**
  * Implements hook_form_alter().
 */
function YOUR_MODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if($form_id == 'YOUR_FORM_ID') {
    //here you can make the copy
    $form['field_add_option_copy'] = $form['field_add_option'];
  }   
}


You can read this: Creating modules - a tutorial: Drupal 7.x