I have to load a php file inside a 'div' in my html code. For this I've used 'required_once('filename.php') which works.
I tried JQuery way,
$("#btnSubmit").click(function(){
$("#earth").load('filename.php');
});
});
Can anyone tell me a way to send data(value of dropdown) to 'filename.php' and then load the 'filename.php' inside the div with id='earth' ?
This is my HTML code
<body>
<div class="row">
<form class="form-inline" action="" method="post">
<div class="btn-group">
<a class="btn btn-default dropdown-toggle btn-select" data-toggle="dropdown" href="javascript:;">
Select Country/City
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="javascript:;">Africa</a></li>
<li><a href="javascript:;">London</a></li>
<li><a href="javascript:;">South Africa</a></li>
<li><a href="javascript:;">Korea</a></li>
<li><a href="javascript:;">Delhi</a></li>
<li><a href="javascript:;">Las Vegas</a></li>
</ul>
</div>
<div class="btn-group">
<button type="submit" id="btnSubmit" class="btn btn-green">Read</button>
</div>
</form>
</div>
<div class="row">
<div class="col-md-12">
<div class="portlet box blue">
<div class="portlet-body">
<div class="dataTable_wrapper">
<div id="earth">
<?php require_once 'filename.php'; ?> (1) <-- Pass value to this file
</div>
</div>
</div>
</div>
</div>
</div>
This is the filename.php
<?php
HERE I WANT TO GET THE VALUE SELECTED IN THE DROPDOWN i.e Africa/London etc?
$selectedCity = ??
echo "<h2> Hello User! </h2>";
echo "<p> You selected ".$selectedCity."</p>";
?>