Introduction:
Most of the times due to certain complex reasons, programmers have to create such a forms which contains array elements. Our discussion will be upon “How to handle these elements with PHP”.
HTML FORM:
File Name: forms.html
Form Code:
<input type=”text” name=”text1[]” />
<input type=”text” name=”text1[]” />
<input type=”text” name=”text1[]” />
</form>
PHP Code:
File Name: subimt.php
<?$text=$_POST[‘text1’];
If(!empty($text)){
Foreach($text as $key->$value){
Echo $key.’<br />’;
Echo $value;
}
?>
When you don’t have any choice to handle the forms elements or multiple elements this technique will help you to solve major issues while developing a complex form and application.

No comments:
Post a Comment