form.php:
script.php:
<?php
include('conn.php');
if(isset($_GET['id2']))
{
$id1=$_GET['id2'];
session_start();
$_SESSION['id1']=$id1;
$select2 = mysql_query("SELECT * from member where fid='$id1' ");
$i=1;
while($row1 = mysql_fetch_array($select2))
{
$fid=$row1['fid'];
$memberslist=$row1['memberslist'];
?>
<p style="text-align:center; font-size:18px;">Members:<span id="txtHint2"><?php echo $memberslist;?></span></p>
<form action="" name="form1"> <tr ><td >
<select name="members" onchange="showCustomer2(this.value">
<option value="">Select</option> <option value="platinum" >Platinum</option> <option value="gold" >Gold</option> <option value="diamond" >Diamond</option> <option value="economical" >Economical</option> <option value="freelisting" >Freelisting</option> </select></td></tr><br>
script.php:
<script type="text/javascript">
function showCustomer2(str2)
{
// alert("hi");
var xmlhttp;
if (str2=="")
{
document.getElementById("txtHint2").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint2").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","member.php?q="+str2,true);
xmlhttp.send();
}
</script>
member.php:
<?php
include("conn.php");
session_start();
$id3=$_SESSION['id1'];
if(isset($_GET['q']))
{
$id1=$_GET['q'];
$update=mysql_query("update member set memberslist='$id1' where fid='$id3'");
$select2 = mysql_query("SELECT * from member where fid='$id3' ");
$i=1;
while($row1 = mysql_fetch_array($select2))
{
echo $row1['memberslist'];
} }
?>
No comments:
Post a Comment