PHP - Adding text values of multiple text box values to a variable
<p>I want to add the following information to a variable, (The txt-via-hn textboxes are house numbers, the txt-via are address details)</p>

<pre><code>$vias =         $_POST['txt-via-hn2'].' '.$_POST['txt-via2'] 
               .$_POST['txt-via-hn3'].' '.$_POST['txt-via3']
               .$_POST['txt-via-hn4'].' '.$_POST['txt-via4']
               .$_POST['txt-via-hn5'].' '.$_POST['txt-via5']
               .$_POST['txt-via-hn6'].' '.$_POST['txt-via6']
               .$_POST['txt-via-hn7'].' '.$_POST['txt-via7']
               .$_POST['txt-via-hn8'].' '.$_POST['txt-via8']
               .$_POST['txt-via-hn9'].' '.$_POST['txt-via9']
               .$_POST['txt-via-hn10'].' '.$_POST['txt-via10'];
</code></pre>

<p>I'm fairly new to PHP so I'm not too sure how to go about doing this but basically the format that I need this to be in is as follows:</p>

<pre><code>$vias = &lt;vias&gt;
        &lt;vh1&gt;$_POST['txt-via-hn2']&lt;/vh1&gt;&lt;vi1&gt;$_POST['txt-via2']&lt;/vi1&gt;
        &lt;vh2&gt;$_POST['txt-via-hn3']&lt;/vh2&gt;&lt;vi2&gt;$_POST['txt-via3']&lt;/vi2&gt;
        &lt;vh3&gt;$_POST['txt-via-hn4']&lt;/vh3&gt;&lt;vi3&gt;$_POST['txt-via4']&lt;/vi3&gt;
        &lt;vh4&gt;$_POST['txt-via-hn5']&lt;/vh4&gt;&lt;vi4&gt;$_POST['txt-via5']&lt;/vi4&gt;
        &lt;vh5&gt;$_POST['txt-via-hn6']&lt;/vh5&gt;&lt;vi5&gt;$_POST['txt-via6']&lt;/vi5&gt;
        &lt;vh6&gt;$_POST['txt-via-hn7']&lt;/vh6&gt;&lt;vi6&gt;$_POST['txt-via7']&lt;/vi6&gt;
        &lt;vh7&gt;$_POST['txt-via-hn8']&lt;/vh7&gt;&lt;vi7&gt;$_POST['txt-via8']&lt;/vi7&gt;
        &lt;vh8&gt;$_POST['txt-via-hn9']&lt;/vh8&gt;&lt;vi8&gt;$_POST['txt-via9']&lt;/vi8&gt;
        &lt;vh9&gt;$_POST['txt-via-hn10']&lt;/vh9&gt;&lt;vi9&gt;$_POST['txt-via10']&lt;/vi9&gt;
        &lt;/vias&gt;
</code></pre>

<p>Also, if for example <code>$_POST['txt-via-hn10']</code> &amp; <code>$_POST['txt-via10']</code> are empty, would it be possible that <code>&lt;vh9&gt; and &lt;/vh9&gt;</code> are not included in the variable?</p>

<p>Any help on this would be much appreciated! :)</p>
