i have 3 variables $page_no,$noc_no,$doc_no
these are coming from 3 different drop down on other page
only one is active at a time i want to assign one of the variable to variable in select statement ie $card_id at a time

$page_no=$_POST["page_no"];
$page_no=$_POST["page_no"];
$yr=$_POST["publication_year"];

$noc_no=$_POST["noc_no"];
//echo $noc_no;

$doc_no=$_POST["doc_no"];
//echo $doc_no;


//echo "card_id1=".$card_id;
//echo "yr=$yr<br>";
?>
<html>


<form action="right.php" name="search_noc1" method="POST">
<table border=0>
<tr><td>
<?php	

//echo "hello";

	if($card_id != 0)
	{
	//echo "card_id2=$card_id<br>";
		echo "<div >";
		echo "<table  border='0'  width='100%'>";
		echo "<tr><td align='right'>";
		
		//If no Judgement Text is entered for this card, do not show "View Judgement Button"
         

		$get_judgement=mysql_query("SELECT count(*) as cnt FROM judgmenttext where anCardId=".$card_id);
		//echo $get_judgement;
		$cnt_judgement=mysql_fetch_row($get_judgement);

you can use either use

if ( $page_no != 0 )  { 
$card_id = $page_no;
} elseif ( $noc_no != 0 )  { 
$card_id = $noc_no;
} elseif ( $doc_no != 0 )  { 
$card_id = $doc_no;
}

or you can also assign the selected value from the database which shud be assigned to $card_id to a hidden variable from the page where you are passing the values from the select box.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.