Saturday, August 22, 2009

Handling Array form elements with php

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:

<form action=”submit.php” method=”post” name=”form1”>

<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

All rights are reserved. Nobleatom.com
Software Development Services.
Contact me: khubabmazhar596@hotmail.com

Web Design Increase Page Rank Internet blogs DigNow.net web directory1Abc DirectorySeo friendly web directory