Click here to Skip to main content
12,820,857 members (27,907 online)
Rate this:
Please Sign up or sign in to vote.
See more: PHP MySQL
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">

                  <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



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

<input type="radio" name="rad" value="Buildings" >Buildings


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

					<td >Amount</td>

<input type="radio" name="rad" value="land" >Land</td>
//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>
				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>";




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


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

1 solution

Rate this: bad
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
<script language="javascript">
function onclick_show()

alert("hello world");
<input type="radio"  önclick="onclick_show()" name="kis" /> Click and see the effect

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170308.1 | Last Updated 7 Aug 2012
Copyright © CodeProject, 1999-2017
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