Skip to content

Instantly share code, notes, and snippets.

@ramlila
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ramlila/30fe396db2f1108a5786 to your computer and use it in GitHub Desktop.
Save ramlila/30fe396db2f1108a5786 to your computer and use it in GitHub Desktop.
<?php
session_start();
include('db.php');
if(isset($_POST['data'])) {
$list = isset($_SESSION['strtpnt1']) ? $_SESSION['strtpnt1'] : [];
$list[] = $_POST['data'];
$_SESSION['strtpnt1'] = $list;
}
$startpoint= (implode(',',$_SESSION['strtpnt1']));echo "valar morghulis";
print_r($startpoint);
?>
<td id="td12" class="hc">
<select name="destination" id="destination" onChange="ajaxcall1(this.value)" class="inp_bx">
<option value="">Select a Destination</option>
<?php
$sql21 = "select start from tbl_place where start NOT IN('".$startpoint."')";
$retval21 = mysql_query($sql21, $conn );
if(! $retval21 )
{
die('Could not get data: ' . mysql_error());
echo 'Could not get data: ' . mysql_error();
}
while($row = mysql_fetch_assoc($retval21,MYSQL_ASSOC)){ $dest= $row['start'];?>
<option value="<?php echo $dest;?>"><?php echo $dest;?></option>
<?php } ?>
</select>
<?php echo "valar morghulis saSAsAS";print_r($_SESSION['strtpnt1']);?>
</td>
<!--1st select box-->
<td class="h_c">
<select name="strtpnt" id="strtpnt" class="inp_bx" onChange="ajaxcall(this.value)">
<option>-Select-</option>
<?php
$sql = "select distinct(start) from tbl_place";
$retval = mysql_query($sql, $conn );
while($row = mysql_fetch_assoc($retval,MYSQL_ASSOC)){ $strtpnt= $row['start'];?>
<option value="<?php echo $strtpnt;?>"><?php echo $strtpnt;?></option>
<?php } ?>
</select>
<!--2nd select box--><td class="hc">
<select name="destination" id="destination" class="inp_bx">
<option>-Select-</option>
</select></td>
<!--3rd select box-->
<select name="duration" id="duration" class="inp_bx" onchange="textHint();">
<option value="1">-Select-</option>
<?php
$sql = "select distinct(package_type) from tbl_package";
$retval = mysql_query($sql, $conn );
while($row = mysql_fetch_assoc($retval,MYSQL_ASSOC)){ $package= $row['package_type'];?>
<option value="<?php echo $package?>"><?php echo $package;?></option>
<?php } ?>
</select>
<input name="submit" id="submit" type="submit" class="btn btn-lg btn-info" value="Submit">
///Now the ajax calls
<script type="text/javascript">
function textHint()
{
//alert("valar morghulis .arya");
var start=$("#strtpnt").val();
var destin=$("#destination").val();
var ans=confirm("Do you want to continue touring");
if(ans)
{
alert("Enjoy the tour visiting various places");
$.post('tour.php', { start:start,destin:destin}, function(response) {
console.log(response);
$('.h_c').html(response);
});
}
else
{
window.Location="http://localhost/tpc_new/home1.php";
}
return false;
}
function ajaxcall(type)
{
var parameters = 'data='+type;
var argUrl = 'ajax_data.php';//alert(parameters);
$.ajax({
url: argUrl,
type: 'POST',
data: parameters,
success: function (str) {
$(".hc").html(str);
alert(parameters);
}
});
}
</script>
<!--page is same as home1.php-->
<div class="col-md-10 col-md-offset-2" >
<h3 style="padding-left:285px;">Enter the Details</h3>
Starting Point</label><td>:</td><td class="h_c">
<select name="strtpnt" id="strtpnt" class="inp_bx" onChange="ajaxcall(this.value,'start1','hc')">
<option>-Select-
</option>
<option value="<?php echo $destinationpoint;?>"><?php echo $destinationpoint;?></option>
</select>
</td></tr>
Destination Point</td><td>:</td><td class="hc">
<select name="destination" id="destination" onChange="ajaxcall1(this.value)" class="inp_bx">
<option>-Select-</option>
</select>
Duration<td> :</td><td>
<select name="duration" id="duration" class="inp_bx" onchange="textHint();">
<option value="1">-Select-</option>
<?php
$sql = "select distinct(package_type) from tbl_package";
$retval = mysql_query($sql, $conn );
while($row = mysql_fetch_assoc($retval,MYSQL_ASSOC)){ $package= $row['package_type'];?>
<option value="<?php echo $package?>"><?php echo $package;?></option>
<?php } ?>
</select>
<input name="submit" id="submit" type="submit" class="btn btn-lg btn-info" value="Submit">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment