Hi Everyone,
Can somebody help me out in this problem.
I am getting a value from 1 page to another through $_GET[].
When I redirect to other page it shows me its value in URL as well as in a query where I am using it further as this. Here assigncow is the value I am getting from previous page
URL
docassign.php?cow=389&cit=a
Query
update `docinfo` set `assigncow`='389' where `docid`='2' and `city`='a'
But When I click on some other city option, assigncow becomes blank
What to do for it..
Here is the code
$getcowid = $_GET['mid'];
echo $getcowid;
$query1 = "SELECT DISTINCT `city` FROM `docinfo`";
echo $query;
$result = mysql_query ($query1);
echo "<form name='input' method='post'>";
echo "<table border='1' align='center'>";
echo "<tr>";
echo "<td><b>Locations of the available Doctors </b>";
echo "<tr>";
while($row = mysql_fetch_array($result))
{
echo "<td><a href='docassign.php?cow={$getcowid}&cit={$row['city']}'>".$row['city']."</td>";
echo "<tr>";
}
$getcity = $_GET['cit'];
//echo $getcity;
$gc = $_GET['cow'];
echo $gc;
$slctdoc = "select `docid`, `doctor`, `hospital`, `expert`, `phone` from `docinfo` where `city` = '$getcity'";
//echo $slctdoc;
$rundoc = mysql_query($slctdoc);
echo "<table border='1' cellspacing='10' cellpadding='10' align='center'>";
echo "<tr>";
echo "<td><b>Doctor </b></td>";
echo "<td><b>Hospital</b></td>";
echo "<td><b>Expert</b></td>";
echo "<td><b>Contact No.</b></td>";
echo "<tr>";
while($row=mysql_fetch_array($rundoc))
{
echo "<td>".$row['doctor']."</td>";
//$var = $row['docid'];
//echo $var;
echo "<td>".$row['hospital']."</td>";
echo "<td>".$row['expert']."</td>";
echo "<td>".$row['phone']."</td>";
echo "<td><input type='checkbox' value='".$row['docid']."' name='asgn[]'>Assign</td>";
echo "<td><input type='submit' name='submit' value='Submit'></td>";
echo "<tr>";
}
//$ass = $_POST['asgn'];
//echo $ass;
//$selectdoc = "SELECT `docid` FROM `docinfo` where"*/
foreach ($_REQUEST['asgn'] as $checkbox)
{
$var = $checkbox;
//echo $var;
}
//echo $as;
$slctassign = "update `docinfo` set `assigncow`='$gc' where `docid`='$var' and `city`='$getcity'";
echo $slctassign;
$runassign=mysql_query($slctassign);