i have to pass that train number to the api url and get the response.based on the response i will include in jquery.
kindly help me how to pass the formvalue into outisde the form within the page..
for example suppose if i type palani in the train number field it should the pass value as http://api.railwayapi.com/suggest_train ... /---->here my text will go whatever i typed.
else any smarter method there kindly suggest me.
Code: Select all
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<title>Live Train Running Status|Indian Railways Live Train Status|spot your train</title>
<script src="path/to/jquery.easy-autocomplete.min.js"></script>
<script>
var options = {
url: $url,
getValue: "train",
list: {
match: {
enabled: true
}
}
};
$("#trainnumber").easyAutocomplete(options);
<?php
$json = '';
if(isset($_GET['trainnumber'])) {
$url = 'http://api.railwayapi.com/suggest_train/trains/'.$_GET['trainnumber'].'/apikey/*/';
?>
</script>
<head>
<body>
<center><h2><b>Live Train Running Status</b></h2></center>
<ul>
<li><a class="active" href="#home">Home</a></li>
<li><a href="#news">Live Train Status</a></li>
<ul style="float:right;list-style-type:none;">
<li><a href="#about">Blog</a></li>
<li><a href="#login">Contact</a></li>
</ul>
</ul>
<h3>live train running status provide the information about current train running status,so that you can easily spot your train.you also get the details about train departure ,arrivals and late time in every station here.</h3>
<center>
<div id="page-wrap"><form action="livetrainstatus.php" method="GET">
<tr>
<td> Train Number</td></br>
<td><input type="text" name ="trainnumber" size="20"> </td>
</tr></br></br>
<tr>
<td> Select Date</td></br>
<td><select name="doj">
<option value="<?php echo date('Ymd', strtotime("today")); ?>">Today</option>
<option value="<?php echo date('Ymd', strtotime("tomorrow")); ?>">Tomorrow</option>
<option value="<?php echo date('Ymd', strtotime("tomorrow")); ?>">Yesterday</option>
</select></td>
</tr></br></br>
<tr>
<td><input type="submit" value ="submit" size="20">
</td></br>
</form></br></br>
</div>
</center>
</body>
<footer>
<?php include_once("analyticstracking.php") ?>
<script type="text/javascript" src="usersontxt.php?uvon=showon"></script></footer>
</html>