Problem with get_the_title in not rendering the way I want

The Core functions the_permalink(), and get_permalink() are built to do what you are trying to hack together manually. Those will provide a complete URL for the link.

What you are doing would at best be a relative link, which is problematic, and there is no guarantee that the title would match the URL anyway. Permalinks are transformed in several different ways, they are manually editable, and are also forced to be unique by the addition of appendixes if necessary.

Edit:

To create internal links, all you need are unique identifiers. There are a couple of ways to do that without straying far from core code.

<a  href="#<?php echo sanitize_title_with_dashes(get_the_title()); ?>"> 
  <?php echo get_the_title();?>  
</a>

sanitize_title_with_dashes() is the function used by the Core in the conversion of the title to the post slug.

This means that within a Loop, you can use the post slug itself for much the same effect.

<a  href="#<?php echo $post->post_name; ?>"> 
  <?php echo get_the_title();?>  
</a>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)