0

hi there, need some help:

i have a command button in which it will generate a textbox whenever it is clicked, thus, if it is clicked 5 times, then 5 textboxes will appear.

please help me with this, i want to code this using PHP or even HTML..

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by sibizulu
0

javascript.js

var xmlhttp;

function show(str)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="process.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}


function stateChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById("display").innerHTML=xmlhttp.responseText;
}
}


function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
return new XMLHttpRequest();
}
if (window.ActiveXObject)
{
// code for IE6, IE5
return new ActiveXObject("Microsoft.XMLHTTP");
}
return null;
}

index.php


<html>
<body>
<form action=# method=post>
<h4>How many textbox you want</h4>
<input type=text name=no onchange="show(this.value)">
</form>
</body>
</html>


process.php

<?php
$q=$_GET[q];
for(i=0;i<$q;i++)
{
?>
<input type=text>
<?php
}
?>


Try it yourselt.k(i didn't check it). if you have any difficulty please reply k.........

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.