title: Create random string in PHP Smarty template
body: <p>I have the following input field:</p>
  
  <pre><code>{assign var="name" value="test12345.example.com"}
  
  &lt;input name="domain" value="{$domain}" size="50" 
  data-hostname-check="{$options}"
  placeholder="&lt;?php echo substr(md5(mt_rand()), 0, 7); ?&gt;"
  onchange="if (
  typeof simulateCart == 'function' &amp;&amp; this.checkValidity())
  simulateCart.call(this);"/&gt;
  </code></pre>
  
  <p>What i need is to generate a random string for if the input field when its not filled. But I have no clue how to do this. This input field is in an if loop using smarty template.</p>
  
  <p>The onchange is required at the moment so if I remove this you can leave the input field blank but there should be a label before we can insert it into the database</p>
  
  <p>At the moment I have a var (static) whichh i can use for the placeholder text. The echo which i tried does not work. Maybe someone can help me fixing this. If i put this in the placeholder the whole text in the "" will be displayed.</p>
  
  <p>Another issue is that the form has an input validation and you have to press on a button. I know there is an jQuery on.click how can i use this in my situation.</p>