web 2.0

How to use PHP & Multiple Input Text Field/Textbox

How to use PHP & Multiple Input Text Field/Textbox This tutorial how to using PHP read a variable from multiple input textbox

ShotDev Focus:
- Using PHP & Multiple Textbox

Example 1

php_multiple_textbox1.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form action="php_multiple_textbox2.php" method="post" name="form1">
<input type="text" name="txtSiteName[]"><br>
<input type="text" name="txtSiteName[]"><br>
<input type="text" name="txtSiteName[]"><br>
<input name="btnSubmit" type="submit" value="Submit">
</form>
</body>
</html>

php_multiple_textbox2.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
for($i=0;$i<count($_POST["txtSiteName"]);$i++)
{
echo "txtSiteName $i = ".$_POST["txtSiteName"][$i]."<br>";
}
?>
</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_multiple_textbox1.php

Screenshot

PHP Multiple Textbox

PHP Multiple Textbox
.
.

Example 2 (Create Element)

php_multiple_textbox3.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
<script language="javascript">
function fncCreateElement(){

var mySpan = document.getElementById('mySpan');

var myElement1 = document.createElement('input');
myElement1.setAttribute('type',"text");
myElement1.setAttribute('name',"txtSiteName[]");
mySpan.appendChild(myElement1);

var myElement2 = document.createElement('<br>');
mySpan.appendChild(myElement2);
}
</script>
</head>
<body>
<form action="php_multiple_textbox4.php" method="post" name="form1">
<input type="text" name="txtSiteName[]">
<input name="btnButton" type="button" value="+" onClick="JavaScript:fncCreateElement();"><br>
<span id="mySpan"></span>
<input name="btnSubmit" type="submit" value="Submit">
</form>
</body>
</html>

php_multiple_textbox4.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
for($i=0;$i<count($_POST["txtSiteName"]);$i++)
{
echo "txtSiteName $i = ".$_POST["txtSiteName"][$i]."<br>";
}
?>
</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_multiple_textbox4.php

Screenshot

PHP Multiple Textbox

PHP Multiple Textbox

.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (5 votes, average: 8.00 out of 10)
Loading ... Loading ...

9 Responses to “How to use PHP & Multiple Input Text Field/Textbox”

  1. home…

    nni How to use PHP & Multiple Input Text Field/Textbox | ShotDev.Com Antonio Amadeo as well as Gian Giacomo Dolcebuono. Around ‘08 home IFFCO as well as Nike jordans Phosphates Mines Company Ltd (JPMC) involving Nike air jordan got stated the jv -…

  2. ナイキ dunk sb…

    gaining the way to engage in your guitar will not be always easy for everybody. Pursuing coaching internet ナイキ dunk sb makes it possible for every single university student to consider their particular occasion How to use PHP & Multiple Input …

  3. ナイキsb…

    sembling your human being back bone plus the elements addressing pores and skin etcetera. ナイキsb If you’d prefer to experience a set of Fresh air Utmost boots and shoes, most of us will give essentially the most low-priced Air flow Optimum shoe…

  4. home…

    chemical nowadays,. Understand what desire to be away from the culture. Abide by it. It is quite How to use PHP & Multiple Input Text Field/Textbox | ShotDev.Com easy. Things you need is definitely your personal computer in addition to home any sen…

  5. ナイキsb…

    polished, shinny surface types that makes it incredibly beautiful. They will make use of products just like jute, man made fiber, natural leather, great How to use PHP & Multiple Input Text Field/Textbox | ShotDev.Com bed linen material, materials, b…

  6. nike air force…

    a layouts in order to bed-making along with marketing. Little by little yet slowly nike air force the girl familiar himself How to use PHP & Multiple Input Text Field/Textbox | ShotDev.Com regionally. Different famous people seeing that able-bodied…

  7. ナイキsb pro…

    ine save labeled ナイキsb pro Firmoo features free of charge How to use PHP & Multiple Input Text Field/Textbox | ShotDev.Com portions of modern variations as well as eye-catching colorations awaiting people. Within particulars, no cost a pair o…

  8. home…

    our self regarding this specific go back and even repair insurance policies to the merchant since you also can easily often property throughout problem right after many How to use PHP & Multiple Input Text Field/Textbox | ShotDev.Com home of the de…

  9. ナイキ エアマックス…

    ys can come in numerous various models and have 3 with forty eight in a very location suitable. Many people are also available in the actual revolving along with non-rotating. Most people hold How to use PHP & Multiple Input Text Field/Textbox | ShotD…

Leave a Reply

You must be logged in to post a comment.