0

I am doing online shoping webpage.i required to show textboxes based on input number By using onKeyPress Event.

Ex: textBooks Howmany

 PHP Guid     3

Then create 3 textboxes with same name PHP Guid in bellow.

like

 PHP Guid 
 PHP Guid
 PHP Guid 

Thanking you in Advance.

3 Answers 3

2
<html>
<head>
<title>Dynamic Form</title>
<script language="javascript">
function changeIt(count)
{
var i;
for(i=0;i<count;i++)
{
my_div.innerHTML = my_div.innerHTML +"<br><input type='text' name='mytext'+ i>";
}

}
</script>
</head>
<body>

<form name="form" action="post" method="">
<input type="text" name="t1" onblur="changeIt(this.value)">

<div id="my_div"></div>
</form>
</body>
Sign up to request clarification or add additional context in comments.

Comments

1

try this

if input number is 5

for($j = 1; $j <= 5; $j++) {

echo "<input type="text"  name="textfield[]">";

}

Comments

0

Hima

function duplicate() { var l=Number(document.getElementById('textbox name where u r entered')); for($i = 0; $i<l; $i++) { <input type=\’Text\' name=\'group'.$i.'\' id=\'Textbox'.$i.'\' value=\'' pass text box text here '\' >''</input>'; } }

this is javascript.

and babonk give you solution in php.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.