How To Wrap Drupal Form API in html div structure [in my Drupal theme files (.tpl file)] I have a webpage which is being rendered from my page.tpl.php , it has a login page at top - right of page. 
I am kind of struggling to wrap my LOGIN HTML FORM in Drupal Form API 

Below Links did not help me that much even though it gave me general idea

1. should-i-put-input-tag-inside-label-tag

2. drupal-7-forms-how-do-you-wrap-an-input-in-a-label

3. how-to-put-two-form-elements-in-a-row-using-drupal-form-api
 Below image shows my Login form 

theme_form_element , drupal-form-api-prefix-suffix, using-prefix-and-suffix-form-api-layout and drupal-form-wrap-div-tag-custom-html-prefix-suffix gave me some idea but I am still puzzled about this things. 

{
found some more helpful links for this : 


how-to-create-multiple-forms-in-drupal-7.html
page-user-login.tpl.php
page-template-for-custom-form
Printing a form on a page with drupal_get_form 
}


Can some one guide me for this. 

I am not sure if I should go with Drupal form or just use the normal HTML Login in PHP way.

For Better Understanding of the scenario I am adding screen shots and details of my task below, it is purely just for example, all I am looking for is some guidance for the task I am doing, answer does not have to be exactly FORM API of my HTML but I need to know how to achieve this in page.tpl.php.

[Do I have to create new custom module or I can manage this in my page.tpl.php- sorry if it is very simple question, I am little new here in drupal ]

 


  Here is the HTML


&lt;div class="accessBlock"&gt;
            &lt;button class="primary_btn"&gt;Download Guidelines&lt;/button&gt;
            &lt;button id="loginPopup" class="primary_btn"&gt;Login&lt;/button&gt;
&lt;/div&gt;

&lt;div class="loginBox" style="overflow: hidden; display: block;"&gt;
            &lt;div class="loginHolder"&gt;
                &lt;div class="nameHolder"&gt;&lt;p class="sub-title-1"&gt;Email address&lt;/p&gt;&lt;/div&gt;
                &lt;div class="inputHolder"&gt;&lt;input type="text" placeholder="Enter your email address"&gt;&lt;/div&gt;
                &lt;div class="nameHolder"&gt;&lt;p class="sub-title-1"&gt;Password&lt;/p&gt;&lt;/div&gt;
                &lt;div class="inputHolder"&gt;&lt;input type="password" placeholder="Enter your password"&gt;&lt;/div&gt;
                &lt;div class="nameHolder"&gt;&lt;p class="sub-title-1"&gt;Not registered?&lt;/p&gt;&lt;/div&gt;
                &lt;div class="inputHolder"&gt;&lt;input type="checkbox" vlaue="ss"&gt;&lt;span class="registerNote"&gt;Tick this box and click 'Register'&lt;/span&gt;&lt;/div&gt;
                &lt;div class="buttonHolder"&gt;
                    &lt;button class="primary_btn"&gt;Login&lt;/button&gt;
                    &lt;button class="primary_btn"&gt;Register&lt;/button&gt;
                    &lt;button class="primary_btn"&gt;Cancel&lt;/button&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;


I need to create a Login and Registration Module. I have this whole form in basic html not in form, I am struggling to convert this to Drupal From

Also I am not sure if I should go for Drupal Form or not. Since my requirement is to show the error message in the same place &lt;div&gt; . see below





Thanks :)
It will be hard to implement this html as it is. You have to create a custom form using form api of drupal and use its arguments to make the html nearly same like your design. But still there will be css changes respectively. Let me edit Email field for you

    function mycustomform($form, &amp;$form_state){
    $form['email'] = array(
      '#type' =&gt; 'textfield',
      '#title' =&gt; t('Email address'),
      '#size' =&gt; 60,
      '#maxlength' =&gt; 128,
      '#required' =&gt; TRUE,
      '#prefix'=&gt;'&lt;div class="inputHolder"&gt;&lt;p class="sub-title-1"&gt;',
      '#suffix'=&gt;'&lt;/p&gt;&lt;/div&gt;',
      '#attributes'=&gt;array('placeholder'=&gt;'Enter your email address')
    );

    $form['password'] = array(
      '#type' =&gt; 'password',
      '#title' =&gt; t('Password'),
      '#size' =&gt; 60,
      '#maxlength' =&gt; 128,
      '#required' =&gt; TRUE,
      '#prefix'=&gt;'&lt;div class="inputHolder"&gt;&lt;p class="sub-title-1"&gt;',
      '#suffix'=&gt;'&lt;/p&gt;&lt;/div&gt;',
      '#attributes'=&gt;array('placeholder'=&gt;'Enter your password') // No use because it will show dots or *
    );
    $form['login'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; t('Login'),

      '#prefix'=&gt;'&lt;div class="buttonHolder"&gt;',
      '#suffix'=&gt;'',
      '#submit'=&gt;'custom_user_login',  
      '#attributes'=&gt;array('class'=&gt;array('primary_btn')) // No use because it will show dots or *
    );
    $form['register'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; t('Register'),
      '#submit'=&gt;'custom_user_register',
      '#prefix'=&gt;'',
      '#suffix'=&gt;'&lt;/div&gt;',
      '#attributes'=&gt;array('class'=&gt;array('primary_btn')) // No use because it will show dots or *
    );
return $form;
}

function mycustomform_validate($form, &amp;$form_state){
    //Add checks for already registered user
}

function custom_user_login($form, &amp;$form_state){

      if($uid = user_authenticate($username=$form_state['values']['email'], $password=$form_state['values']['password']))
    {
      user_login_submit(array(), array('uid' =&gt; $uid));
      return true;
    }
    else
    {
        return false;
    }
}

function custom_user_register($form, &amp;$form_state){
    $new_user = array(
  'name' =&gt; $form_state['values']['email'],
  'pass' =&gt; $form_state['values']['password'], // note: do not md5 the password
  'mail' =&gt; $form_state['values']['email'],
  'status' =&gt; 1,
  'init' =&gt; $form_state['values']['email'],

);

// The first parameter is sent blank so a new user is created.
$user = user_save('', $new_user);
if($user-&gt;uid){
drupal_set_message('User saved successfully');
}else{
    drupal_set_message('Error in saving user','error');
}
}


Hope it will help you.