Click here to Skip to main content
15,881,381 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">



		
                  <form name="input" action="searchbox.php?submit=true" method="POST">
		<input type="radio" name="for"  value="sale">For Sale
        <input type="radio" name="for"  value="rent">For Rent
		<input type="radio" name="for"  value="share">For Share

				   

<body>


			<table width="720" border="0" cellspacing="0" cellpadding="1">
				  <tr>
					<th scope="row"> </th>
					<td >Location</td>
					<td >Place</td>
					<td ></td>
					<td> </td>
				  </tr>

				  
					<tr>
<td>
<input type="radio" name="rad" value="Buildings" >Buildings
</td>

				<td>

				  <tr><td><input type="radio" name="rad" value="site">Site</td>


					<td >Amount</td>
					
				
				
				  </tr>
				  <tr>

					<td>
<input type="radio" name="rad" value="land" >Land</td>
					<td> 
					<?php
//set defaults assuming the worst
	
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "";
$mysql_database = "iproperty";
$prefix = "";
$con = mysql_connect($mysql_hostname, $mysql_user, $mysql_password)
 or die("Could not connect database");
mysql_select_db($mysql_database, $con) 
or die("Could not select database");

//verify we have that value in $__POST
if (isset($_REQUEST['for']))
{

   $submit = $_REQUEST['for'];
   print $submit;
    //If it is true, try some math
    if($submit == "sale"&& $submit=="share")
        {
		               if (isset($_POST['rad']))
                {
                        $rad = $_POST['rad'];
						echo   "<select id='others'> 

				  <option value='pid'>Select</option>
				  <option value='bid'>< 5 lack</option>
				  <option value='bid'>5 - 10 lac</option>
				  <option value='bid'>10 - 20 lac</option>
				  <option value='bid'>>20 lac</option>
				  </select>";
						             
                }
				}
				else
				{
				
				if($submit=="rent" && $rad=="Buildings")
				{
				$query="select * from rent ";
                $result=mysql_query($query) or die(mysql_error());
                echo "<select>"; 
                echo "<option value='pid'>Select rent</option>";
                while($row = mysql_fetch_array($result))
                 {
                  echo "<option>".$row['Range']."</option>";
                 }
		   echo "</select>";
		   }
		   					   
			
 		   

mysql_close($con);

	}	
		

 }

?>
</td>
					    
				
                <td><input type="submit" name="submit" value="Search" /></td>
				  </tr>
				</table>
				</form>
			</div><!-- /search bottom div-->
		</div><!-- /searchmain div-->	

		
</body>
</html>


if iam using isset($_POST['submit'])for button it works fine but onclick of radio button i want to work
Posted
Comments
Christian Graus 1-Aug-12 2:44am    
This is just a code dump. You should consider being more precise.
Sergey Alexandrovich Kryukov 1-Aug-12 12:48pm    
Not clear, not a question.
--SA

1 solution

you should use Ajax/javascript only then after clicking on radio button you will see the changes
Test My Code Below
HTML
<html>
<head>
<title>test</title>
<script language="javascript">
function onclick_show()
{

alert("hello world");
}
</script>
</head>
<body>
<input type="radio"  önclick="onclick_show()" name="kis" /> Click and see the effect
</body>
</html>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900