Click to See Complete Forum and Search --> : Urgent!!! PHP: text input field auto creation


casy
05-10-2003, 09:34 PM
:confused:Can anyone tell me how to create a new text field upon entering another field?

Such that when i enter something into the 1st input text field, e 2nd one is created automatically within the same page without page refreshing??

Is it possible anyway??

Kinda urgent here, pls help!!!

pyro
05-11-2003, 08:05 PM
PHP is server side, and thus the page must be refreshed to affect a change. But, you can do this with javascript, if that is a possibility. Take a look at this sample code:

<html>
<head>

<script language="javascript" type="text/javascript">
function showField() {
if (document.myform.text01.value != "") {
document.myform.text02.style.display = "block";
}
}
</script>

</head>
<body>

<form name="myform">
<input type="text" name="text01" onkeyup="showField();">
<input type="text" name="text02" style="display:none">
</form>

</body>
</html>

casy
05-14-2003, 06:41 AM
your code was helpful but how can i create the fields endlessly and in an array form like in PHP??:

something like this :<input type=text name=elect[]>

where all inputs are kept in an array and at the same time i wish to put it in a table display??