Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP MySQL
<!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>&nbsp</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);
 
	}	
		
 
 }
 
?>
 
if iam using isset($_POST['submit'])for button it works fine but onclick of radio button i want to work
Posted 31-Jul-12 20:01pm
Comments
Christian Graus at 1-Aug-12 2:44am
   
This is just a code dump. You should consider being more precise.
Sergey Alexandrovich Kryukov at 1-Aug-12 12:48pm
   
Not clear, not a question.
--SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

you should use Ajax/javascript only then after clicking on radio button you will see the changes
Test My Code Below
<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>
  Permalink  
v2

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



Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 7 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100