I have a php file and I am trying to include another php file in it (for a dropdown) based on what is selected in the radio button but somehow it is not happenning.
To test my work I created a scenario in jsfiddle but there too its not working (i think in jsfiddle i am not loading necessary things which i dont know how to load - please help how to load it in jsfiddle https://jsfiddle.net/7gb4etbw/)
Also need help in javascript function to achieve the above. Appreciate if someone can help me with this. Thank you.
if male is selected, m_ext.php should get included else if female is selected, f_ext.php file should get selected
<?php
if(isset($_POST['submit']))
{
$gender=$_POST['gender'];
$_SESSION['gender']=$gender;
echo "<script language='javascript'>window.location='nextpage.php';</script>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $info['title']; ?></title>
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.11.2.min.js"></script>
<style type="text/css">
.red_color {
color: #F00;
}
</style>
<script language='javascript'>
func()
{
// I am struggling here
}
</script>
</head>
<body>
<form action="" method="post" name="Form1">
<table width="100%" border="0" cellpadding="5" cellspacing="5">
<tr>
<td >
<div align="left"><span class="red_color">*</span>
Gender
</div>
</td>
<td>
<div align="left">
<input id="m" onclick="func()" name="mgender" value="Male" type="radio" />
Male
<input id="f" onclick="func()" name="fgender" value="Female" type="radio" />
Female
</div>
</td>
</tr>
<tr>
<td >
<div align="left"><span class="red_color">*</span>
Message
</div>
</td>
<td >
<div align="left">
<select name="txtname" id="txtid"">
<option value="" selected="selected">-Select-</option>
<?php include("m_ext.php"); ?>
</select>
</div>
</td>
</tr>
</table>
</body>
</html>