Note that there are some explanatory texts on larger screens.

plurals
  1. POadding dynamic field to form
    primarykey
    data
    text
    <p>My users can enter more than one address but I want an actual button that generates the extra fields as only one address is compulsory and empty fields will look ugly! I also need the extra addresses to go into mysql database. How would I do with Javascript if PHP is not possible Some code that may help:</p> <pre><code>&lt;td width="732" valign="top"&gt;&lt;p&gt; &lt;h3 class="main"&gt;Address Details&lt;/h3&gt; &lt;p class="normal"&gt; You are able to add up to 3 addresses but only 1 is compulsory. However it would be helpful if you could insert 3 addresses: &lt;ul&gt; &lt;li&gt;Permanent home address&lt;/li&gt; &lt;li&gt;Postal address (where you will be from June to September)&lt;/li&gt; &lt;li&gt;Local address (where you currently live)&lt;/li&gt; &lt;/ul&gt; &lt;?php if(!empty($err)) { echo "&lt;div class=\"msg\"&gt;"; foreach ($err as $e) { echo "* $e &lt;br&gt;"; } echo "&lt;/div&gt;"; } ?&gt; &lt;br&gt; &lt;form action="address.php" method="post" name="regForm" id="regForm" &gt; &lt;table width="95%" border="0" cellpadding="3" cellspacing="3" class="forms"&gt; &lt;tr&gt; &lt;td&gt;Street&lt;span class="required"&gt;&lt;font color="#CC0000"&gt;*&lt;/font&gt;&lt;/span&gt; &lt;/td&gt; &lt;td&gt;&lt;input name="Street" type="text" id="Street" class="required" size="50"&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Line 2 &lt;/td&gt; &lt;td&gt;&lt;input name="Line2" type="text" id="Line2" class="required" size="50"&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Line 3 &lt;/td&gt; &lt;td&gt;&lt;input name="Line3" type="text" id="Line3" class="required" size="50"&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Town&lt;span class="required"&gt;&lt;font color="#CC0000"&gt;*&lt;/font&gt;&lt;/span&gt; &lt;/td&gt; &lt;td&gt;&lt;input name="Town" type="text" id="Town" class="required" size="30"&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Postcode&lt;span class="required"&gt;&lt;font color="#CC0000"&gt;*&lt;/font&gt;&lt;/span&gt; &lt;/td&gt; &lt;td&gt;&lt;input name="Postcode" type="text" id="Postcode" class="required" size="10"&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Country &lt;font color="#CC0000"&gt;*&lt;/font&gt;&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;select name="Country" class="required" id="select8"&gt; &lt;option value="" selected&gt;&lt;/option&gt; &lt;option value="Afghanistan"&gt;Afghanistan&lt;/option&gt; &lt;option value="Albania"&gt;Albania&lt;/option&gt; (etc) &lt;/select&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Telephone Number&lt;span class="required"&gt;&lt;font color="#CC0000"&gt;*&lt;/font&gt;&lt;/span&gt; &lt;/td&gt; &lt;td&gt;&lt;input name="Tele" type="text" id="Tele" class="required" &gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Fax&lt;span class="required"&gt;&lt;font color="#CC0000"&gt;*&lt;/font&gt;&lt;/span&gt; &lt;/td&gt; &lt;td&gt;&lt;input name="Fax" type="text" id="Fax" class="required" &gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Mobile&lt;span class="required"&gt;&lt;font color="#CC0000"&gt;*&lt;/font&gt;&lt;/span&gt; &lt;/td&gt; &lt;td&gt;&lt;input name="Mobile" type="text" id="Mobile" class="required" &gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Type &lt;font color="#CC0000"&gt;*&lt;/font&gt;&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;select name="Type" class="required" id="select8"&gt; &lt;option value="" selected&gt;&lt;/option&gt; &lt;option value="H"&gt;Home&lt;/option&gt; &lt;option value="P"&gt;Postal&lt;/option&gt; &lt;option value="L"&gt;Local&lt;/option&gt; &lt;/table&gt; &lt;p align="center"&gt; &lt;input name="doAddress" type="submit" id="doAddress" value="Submit"&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload