Hello,
I am trying to display different divs depending on a selection from a drop down menu.
<html>
<head>
<title>DDlist Div Display</title>
<script type="text/javascript">
function ShowDivArea(info) {
var sel = document.getElementById('divArea').getElementsByTagName('div');
for (var i=0; i<sel.length; i++) { sel[i].style.display = 'none'; }
if (info == '0') { return; }
document.getElementById('divArea'+info).style.display = 'block';
}
</script>
<style type="text/css">
.divArea { display:none; height:100px; width:500px; border:1px solid red; }
</style>
</head>
<body>
<select id="DDDivList" onchange="ShowDivArea(this.selectedIndex)">
<option value="0" selected> -- Select A Design Service --</option>
<option value="1"> QR Bookmark </option>
<option value="2"> Twitter </option>
<option value="3"> Ning or Tumblr </option>
<option value="4"> Flyers </option>
<option value="5"> Business Card or Brochure</option>
<option value="6"> Album or Mixtape cover</option>
<option value="7"> Other</option>
</select>
<div id="divArea">
<div id="divArea1" class="divArea">
<form action='code.php' method='GET'>
<input type='text' name='myname'><br>
<input type='submit' value='Click here'>
</form>
<?php
$name = $_GET['myname'];
if ($name)
echo "Hello, $name.";
?>
</div>
<div id="divArea2" class="divArea">
</div>
</body>
</html>
You get the point from here on. More divs for each drop down option.
This is what I don't get: I want to add a different php script to each div. What should code.php be?
Thank you.