title: Generate automatically every time different
body: <p>I need whenever I press the button Add mi generates random codes and you control through DB that isn't already exists, otherwise regenerate them
  I used this script and it works correctly for random generation, the only thing that when I go to add a new record if not update the page always prints the old one</p>
  
  <pre><code>for ($i = 0, $z = strlen($a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890')-1, $s = $a{rand(0,$z)}, $i = 1; $i != 14; $x = rand(0,$z), $s .= $a{$x}, $s = ($s{$i} == $s{$i-1} ? substr($s,0,-1) : $s), $i=strlen($s));
  </code></pre>
  
  <p>When I press Add opens the (modal fade) works with javascript so it doesn't refresh the page.
  thanks a lot</p>