HI I am WORKING ON A PROJECT IN WHICH I HAVE TO CREATE SOME INPUT FIELDS by selecting the number of inputs from a select menu the problem is that when i post the form the fields inside the div are not posted along with the form where as the div in which i am populating the inputs resides within the form
here is the code
[code=javascript]
var xmlCartInputs;
function getCartInputs(v al){
if(val!="none") {
xmlCartInputs=G etXmlHttpObject ();
if(xmlCartInput s==null){
alert("Please Upgrade Your Browser");
return;
}else{
var url="installati on/inputs.php";
var str_tf="t_input s="+val;
xmlCartInputs.o nreadystatechan ge=$loadPages;
xmlCartInputs.o pen("POST",url, true);
xmlCartInputs.s etRequestHeader ("Content-Type","applicat ion/x-www-form-urlencoded; charset=UTF-8");
xmlCartInputs.s end(str_tf);
}
}
}
function $loadPages(){
if(xmlCartInput s.readyState==4 ){
if(xmlCartInput s.status==200){
document.getEle mentById("cart_ inputs").innerH TML=xmlCartInpu ts.responseText ;
}
}
}
[/code]
[code=html]
<form name="step2" id="step2" target="_self" method="post" onsubmit="retur n formchk(this);" action="">
<tr>
<td></td>
<!--<td align="right" valign="middle" width="50"><inp ut type="button" name="prev" id="prev" value="Previous " /></td>-->
<td valign="middle" width="50"><inp ut type="submit" name="next_2" id="next_2" value="Next" /></td>
</tr>
<tr>
<td align="center" valign="middle" colspan="3">
<table cellspacing="0" cellpadding="5" align="center" width="300" border="0">
<tr>
<td valign="middle" >Total Cart Columns</td>
<td valign="middle" >
<select name="cart_colu mns" id="cart_column s" onchange="getCa rtInputs(this.v alue);">
<option value="none">Se lect Columns</option>
<?php
for($r=1; $r<=20; $r++){
echo "<option value=\"$r\">$r </option>";
}
?>
</select>
</td>
</tr>
<tr>
<td align="center" valign="middle" colspan="2">
<div id="cart_inputs "></div>
</td>
</tr>
</table>
</td>
</tr>
</form>
[/code]
FILE INPUTS.PHP CODE
[CODE=PHP]
<?php
header('Expires : Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');
include("config .php");
if(isset($_POST['t_inputs'])){
$tInputs=$_POST['t_inputs'];
echo '<table cellpadding="5" cellspacing="0" align="center" border="0">';
for($i=1; $i<=$tInputs; $i++){
echo '<tr>
<td valign="middle" >Column Name '.$i. '</td>
<td valign="middle" ><input type="text" name="column_na me_'.$i.'" id="column_name _'.$i.'" value="" /></td>
</tr>
';
}
echo '</table>';
}
?>
[/CODE]
here is the code
[code=javascript]
var xmlCartInputs;
function getCartInputs(v al){
if(val!="none") {
xmlCartInputs=G etXmlHttpObject ();
if(xmlCartInput s==null){
alert("Please Upgrade Your Browser");
return;
}else{
var url="installati on/inputs.php";
var str_tf="t_input s="+val;
xmlCartInputs.o nreadystatechan ge=$loadPages;
xmlCartInputs.o pen("POST",url, true);
xmlCartInputs.s etRequestHeader ("Content-Type","applicat ion/x-www-form-urlencoded; charset=UTF-8");
xmlCartInputs.s end(str_tf);
}
}
}
function $loadPages(){
if(xmlCartInput s.readyState==4 ){
if(xmlCartInput s.status==200){
document.getEle mentById("cart_ inputs").innerH TML=xmlCartInpu ts.responseText ;
}
}
}
[/code]
[code=html]
<form name="step2" id="step2" target="_self" method="post" onsubmit="retur n formchk(this);" action="">
<tr>
<td></td>
<!--<td align="right" valign="middle" width="50"><inp ut type="button" name="prev" id="prev" value="Previous " /></td>-->
<td valign="middle" width="50"><inp ut type="submit" name="next_2" id="next_2" value="Next" /></td>
</tr>
<tr>
<td align="center" valign="middle" colspan="3">
<table cellspacing="0" cellpadding="5" align="center" width="300" border="0">
<tr>
<td valign="middle" >Total Cart Columns</td>
<td valign="middle" >
<select name="cart_colu mns" id="cart_column s" onchange="getCa rtInputs(this.v alue);">
<option value="none">Se lect Columns</option>
<?php
for($r=1; $r<=20; $r++){
echo "<option value=\"$r\">$r </option>";
}
?>
</select>
</td>
</tr>
<tr>
<td align="center" valign="middle" colspan="2">
<div id="cart_inputs "></div>
</td>
</tr>
</table>
</td>
</tr>
</form>
[/code]
FILE INPUTS.PHP CODE
[CODE=PHP]
<?php
header('Expires : Mon, 26 Jul 1997 05:00:00 GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');
include("config .php");
if(isset($_POST['t_inputs'])){
$tInputs=$_POST['t_inputs'];
echo '<table cellpadding="5" cellspacing="0" align="center" border="0">';
for($i=1; $i<=$tInputs; $i++){
echo '<tr>
<td valign="middle" >Column Name '.$i. '</td>
<td valign="middle" ><input type="text" name="column_na me_'.$i.'" id="column_name _'.$i.'" value="" /></td>
</tr>
';
}
echo '</table>';
}
?>
[/CODE]
Comment