I just don't see the problem. Need some new eyes to review it. Two files included test.php and test2.php to var_dump. Help!! Cut, Paste and Run - Thanks
test.php:
<?php
ini_set('error_reporting', E_ALL );
ini_set('display_errors', "1");
?>
<style type="text/css">
div.tabcontent{
visibility: hidden;
position:absolute;
left:20px;
}
</style>
<script type="text/javascript">
function switch_div(){
val=document.form1.a_type.selectedIndex;
if (val < 3){
val="a0";
data=document.getElementById("data_types").innerHTML+document.getElementById(val).innerHTML;
}else if (val==3){
val="a"+document.form1.a_type.selectedIndex;
data=document.getElementById("data_types").innerHTML+document.getElementById(val).innerHTML;
}else{
val="a"+document.form1.a_type.selectedIndex;
data=document.getElementById(val).innerHTML;
}
document.getElementById('anw_wksp').innerHTML=data;
}
</script>
<html>
<body>
<form name="form1" action="test2.php" method="post" >
<table>
<th >Enter Anwsers</th>
<tr>
<td>Anwser Type</td>
</tr>
<tr>
<td><select name="a_type" onChange="switch_div()"/>
<option value='radio'>radio</option>
<option value='checkbox'>checkbox</option>
<option value='select'>select</option>
<option value='text'>text</option>
<option value='textarea'>textarea</option>
</select>
</td>
</tr>
<div id="anw_wksp" style="border:1px solid gray; margin-bottom: 1em; padding: 10px">
</div>
<div id="data_types" class="tabcontent">
<table>
<th colspan="3">Data type</th>
<tr><td>
<input type="radio" name="a_data_type" value="text" selected>text<br>
<input type="radio" name="a_data_type" value="int">int </td>
</td>
</tr>
</table>
</div>
<div id="a0" class="tabcontent"> <!--radio/checkbox/select button-->
<table>
<th>Readable Anwser</th><th>DB Value</th><th>Default</th>
<? $i=0;
while($i < 10){
echo "<tr><td><input type=\"text\" name=\"a_r_$i\" /></td>
<td><input type=\"text\" name=\"a_db_$i\" /></td>
<td><input type=\"radio\" name=\"default\" value=\"$i\" /></td></tr>";
$i++;
}
?>
</table>
</div>
<div id="a3" class="tabcontent">
<table>
<th>Readable Anwser</th><th>DB Value</th><th>Default</th>
<tr><td><input type="text" name="a_r_text"></td>
<td><input type="text" name="a_db_text"></td>
<td><input type="text" name="default_text" ></td></tr>
</table>
</div>
<div id="a4" class="tabcontent">
<table>
<th>Readable Anwser</th><th>Default</th>
<tr><td><input type="text" name="a_r_textarea"></td>
<td><textarea name="default_textarea" rows="5" cols="30"></textarea></td></tr>
</table>
</div>
</td>
</tr>
</td>
</tr>
<tr>
<td><input type="submit" value="Enter" name="submit">
</td>
</table>
</form>
</body>
</html>
<script language="javascript">switch_div();</script>
-------------------------------------------------------------------
test2.php:
<?php
$data = file_get_contents('php://input');
if(empty($_SERVER['CONTENT_TYPE'])){
$type = "application/x-www-form-urlencoded";
$_SERVER['CONTENT_TYPE'] = $type;
}
print "_POST = <br />";
var_dump($_POST);
print "<br />";
print " DATA = <br />";
var_dump($data);
?>