Could I please get a skeleton of adding/removing dynamic textboxes and then posting the appended results.
I’d like it to look like this:
[Empty Textbox][Add button]
once Value1 is put into the textbox and add is clicked it’ll show:
[Empty Textbox][Add button]
[Value1][Remove button]
Once everything is added I want it to be posted and allow for people to remove any of the added textboxes.
I’ve been looking for examples and could not find one that works this way.
<form method="post" id="multi" action="process.php">
<label for="cname">Company Name: <span class="required">*</span></label>
<input type="text" size="30px" id="cname" name="cname" value="<?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['cname'] : '' ?>" placeholder="The Rainbow Kingdom" required autofocus />
<label for="name">Contact Name: <span class="required">*</span></label>
<input type="text" size="30px"id="name" name="name" value="<?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['name'] : '' ?>" placeholder="John Doe" required autofocus />
<label for="email">Email Address: <span class="required">*</span></label>
<input type="email" size="50px" id="email" name="email" value="<?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['email'] : '' ?>" placeholder="johndoe@example.com" required />
<label for="telephone">Telephone: </label>
<input size="9px" placeholder="1112223333" autofocus maxlength="9" type="tel" id="telephone" name="telephone" value="<?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['telephone'] : '' ?>" />
<div>
<label>Tag</label><input class="tag" type="text" name="" type="text" />
<div id="content" ></div>
</div>
<label for="message">Message: <span class="required">*</span></label>
<textarea id="message" name="message" placeholder="Your message must be greater than 20 characters" required data-minlength="20"><?php echo ($sr && !$cf['form_ok']) ? $cf['posted_form_data']['message'] : '' ?></textarea>
<p id="req-field-desc">
<span class="required">*</span> indicates a required field
</p>
<span id="loading"></span>
<input type="submit" value="Submit!" id="submit-button" />
</form>
You can take a look at this. Pretty ugly but still readable. Enough for giving you the idea.
The value will be display as normal text, and will be stored in a hidden field with array-like name.
When you submit the form, the data from the hidden fields will be collected.