auto checked unchecked boxes and change the values of the au

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hamzatki
Forum Newbie
Posts: 3
Joined: Thu Feb 22, 2007 11:59 am

auto checked unchecked boxes and change the values of the au

Post by hamzatki »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I have a query that populate the result of a quick search, I have added a checkbox to allow the user to select most suitable options out of the list of the result.

Code: Select all

<?php
// displaying properties 

include "connect.php";

// $sql1 = "select * from property where area='$area' && price_range='$price' &&
 // property_type='$property_type' && no_bedrms='$bedrooms' && no_bathrms='$bathrooms'";

$sql1 = "select * from property where area='$area' && price_range='$price' &&  property_type='$property_type'";

$result1 = mysql_query($sql1);
if (!$result1)
    {
echo "<center><font color='red'>Query Error</font><br><br> Error Selecting Entries !</center>";
    }
else

 {

while ($row=mysql_fetch_array($result1))
{
 $id = $row["id"]; $area1 = $row["area"]; $price_range = $row["price_range"]; $property_type = $row["property_type"]; $no_bedrms = $row["no_bedrms"]; $no_bathrms = $row["no_bathrms"]; $comments = $row["comments"]; $email = $row["email"];  $prop_id = $row["prop_id"]; $mode = $row["mode"]; $bus_name = $row["bus_name"]; 




if (!$area1 == "") 
 
{
echo "

<tr>
      <td width='100%' height='' bgcolor='ffffff' align=''>

<table border='0' width='100%'>
<form action='search_prop1.php' method='post'>
<tr bgcolor='e6e6e6'>
<td valign='top' class='txt_cont_gris' width='20%'>Property Type : <img src='uploads/news_img.jpg' width='38' height='36' alt='' border='1'></td><td valign='top' class='txt_cont_gris'><font color='Maroon'><b>$property_type</b></font> &nbsp; &nbsp; for <font color='Maroon'><b>$mode 
<div align='right'>
$bus_name &nbsp; &nbsp; &nbsp; &nbsp; 
<input type='checkbox' name='prop_id[]' size='4' value='$prop_id' class='text'>Contact Agents</div></b></font></td>
</tr>

<tr bgcolor='e6e6e6'>
<td valign='top' class='txt_cont_gris' width='20%'>No. of Bedrooms : </td><td valign='top' class='txt_cont_gris'><b>$no_bedrms</b></td>
</tr>

<tr bgcolor='e6e6e6'>
<td valign='top' class='txt_cont_gris' width='20%'>No. of Bathrooms : </td><td valign='top' class='txt_cont_gris'><b><b></b>$no_bathrms</b></td>
</tr>

<tr bgcolor='e6e6e6'>
<td valign='top' class='txt_cont_gris' width='20%'>Area Located : </td><td valign='top' class='txt_cont_gris'><b>$area1</b></td>
</tr>

<tr bgcolor='e6e6e6'>
<td valign='top' class='txt_cont_gris' width='20%'>Price Range : </td><td valign='top' class='txt_cont_gris'><font color='Maroon'><b>$price_range</b></font></td>
</tr>

<tr bgcolor='e6e6e6'>
<td valign='top' class='txt_cont_gris' width='20%'>More Details : </td><td valign='top' class='txt_cont_gris'>
$comments</td>
</tr>

<tr bgcolor=''>
<td valign='top' height='5' class='txt_cont_gris' width='20%'></td><td valign='top' class='text' align='center'>
<!-- <hr color='8d977e'  width='250'> -->
</td>
</tr>

</table>
      </td>

   </tr>

<input type='hidden' name='property_type[]' value='$property_type'>
<input type='hidden' name=' value='$mode'>
<input type='hidden' name='price_range[]' value='$price_range'>
<input type='hidden' name='email[]' value='$email'>
<input type='hidden' name='area1[]' value='$area1'>
My main problem here is that if six records are displayed and my user selected 3, it will pass 6 set of 'property_type', 'mode', 'price_range', 'email' and area1 with 3 set of checked 'prop_id' this make it difficult for me to know which prop_id belong to which other fields.

This is what i am getting for now:

property_type----> Flat, Flat, Flat, Flat, Flat, Flat

mode---> sell, rent, rent, sell, sell, sell

price_range---> N2000000 or more, N2000000 or more, N2000000 or more, N2000000 or more, N2000000 or more, N2000000 or more

emai---> gunmi@ayedun.com, bunmi@ayedun.com, sam@yahoo.com, funmi@ayedun.com, sam@yahoo.com, sam@yahoo.com

area1---> Apapa, Apapa, Apapa, Apapa, Apapa, Apapa

prop_id---> funmi@ayedun.com1170175019, sam@yahoo.com1170174365, sam@yahoo.com1170174329

And this is what I want :-

property_type----> Flat, Flat, Flat, Flat, Flat, Flat

mode---> sell, rent, rent, sell, sell, sell

price_range---> N2000000 or more, N2000000 or more, N2000000 or more, N2000000 or more, N2000000 or more, N2000000 or more

emai---> gunmi@ayedun.com, bunmi@ayedun.com, sam@yahoo.com, funmi@ayedun.com, sam@yahoo.com, sam@yahoo.com

area1---> Apapa, Apapa, Apapa, Apapa, Apapa, Apapa

prop_id--->funmi@ayedun.com1170175019,' none', sam@yahoo.com1170174365, ' none',sam@yahoo.com1170174329, 'none '


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply