You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>To use Formr you will need to create a new form object. You can name it anything you like, so let's keep it simple and call it <code>$form</code>.</p>
598
+
<p>To use Formr you will need to create a new form object. You can name it anything you like, so let's keep it simple and call it <codeclass="highlight"><spanclass="nv">$form</span></code>.</p>
<p>There are two arguments we can pass to our new form: the Wrapper, and the Silencer. The Wrapper tells Formr how you want your forms to be laid out; such as with Bootstrap, Bulma, or just a simple <code><div></code> tag.</p>
601
+
<p>There are two arguments we can pass to our new form: the Wrapper, and the Switch. The Wrapper tells Formr how you want your forms to be laid out; such as with Bootstrap, Bulma, or just a simple <code><div></code> tag.</p>
<p>Formr will automatically echo form elements and messages to the screen, and this is usually fine. However, in some instances this is not an option, such as when using a templating framework. In these cases simply pass <code>hush</code> to the switch parameter and then manually <code>echo</code> your elements and messages.</p>
604
+
<p>Formr will automatically echo form elements and messages to the screen, and this is usually fine. However, in some instances this is not an option, such as when using a templating framework. In these cases simply pass <code>hush</code> to the Switch parameter and then manually <codeclass="highlight"><spanclass="k">echo</span></code> your elements and messages.</p>
<p>You can also omit a framework's wrapping div (e.g.; <code><divclass="form-group"></code>) by adding <code>nowrap</code> to the switch parameter.</p>
607
+
<p>You can also omit a framework's wrapping div (e.g.; <codeclass="highlight"><spanclass="o"><</span><spanclass="nx">div</span><spanclass="nx">class</span><spanclass="o">=</span><spanclass="s2">"form-group"</span><spanclass="o">></span></code>) by adding <codeclass="highlight"><spanclass="nx">nowrap</span></code> to the switch parameter.</p>
<p>This method allows you to build incredibly complex forms using simple key/value arrays and strings. <ahref="../fastform/">Read the FastForm docs</a> for complete examples. Validate with the <codeclass="highlight"><spanclass="nx">fastpost</span><spanclass="p">()</span></code> method;</p>
1932
1932
<ol>
1933
1933
<li>The first parameter contains the array (or string) and is required.</li>
1934
-
<li>If you'd like to add CSRF protection, just enter <codeclass="highlight"><spanclass="nx">CSRF</span></code> or <codeclass="highlight"><spanclass="k">TRUE</span></code> in the second parameter.</li>
1934
+
<li>If you'd like to add CSRF protection, just enter either the desired SESSION timeout duration (in seconds), <codeclass="highlight"><spanclass="nx">CSRF</span></code>, or <codeclass="highlight"><spanclass="k">TRUE</span></code> in the second parameter. <codeclass="highlight"><spanclass="nx">CSRF</span></code> and <codeclass="highlight"><spanclass="k">TRUE</span></code> default to a 3600 second (1 hour) timeout.</li>
<p>Identical to <codeclass="highlight"><spanclass="nx">fastform</span><spanclass="p">()</span></code> except that it adds the <codeclass="highlight"><spanclass="p"><</span><spanclass="nt">form</span><spanclass="na">enctype</span><spanclass="o">=</span><spanclass="s">"multipart/form-data"</span><spanclass="p">></span></code> attribute.</p>
1952
1950
<divclass="admonition warning">
1953
1951
<pclass="admonition-title">Warning</p>
1954
-
<p>When using CSRF protection you must enable sessions by adding <codeclass="highlight"><spanclass="nb">session_start</span><spanclass="p">()</span></code> at the top of your file.</p>
1955
1952
</div>
1953
+
<p>When using CSRF protection you must enable sessions by adding <codeclass="highlight"><spanclass="nb">session_start</span><spanclass="p">()</span></code> at the top of your file.</p>
<p>Identical to <codeclass="highlight"><spanclass="nx">fastform</span><spanclass="p">()</span></code> except that it adds the <codeclass="highlight"><spanclass="p"><</span><spanclass="nt">form</span><spanclass="na">enctype</span><spanclass="o">=</span><spanclass="s">"multipart/form-data"</span><spanclass="p">></span></code> attribute.</p>
<li>The required third parameter contains the message body.</li>
2832
2832
<li>The optional fourth parameter accepts a 'from' email address.</li>
2833
2833
<li>The optional fifth parameter is binary: set to <codeclass="highlight"><spanclass="k">TRUE</span></code> if you'd like to send the email as HTML.</li>
2834
+
<li>The optional sixth parameter lets you pass custom mail headers as a string.</li>
2834
2835
</ol>
2835
2836
<divclass="admonition example">
2836
2837
<pclass="admonition-title">Send a plain-text email</p>
<p>If you want prettier emails while looping through the <codeclass="highlight"><spanclass="nv">$_POST</span></code> array, name your input fields with capital letters and underscores, and then prepend each name with an underscore. Prepending a field with an underscore tells Formr to replace all underscores with spaces, making for an easier to read email.</p>
0 commit comments