i'm just having a prblem with displaying records from db in the same page. i'm just trying to write a php code but it didn't show up. Th records are documnted in db by thier first name, middlename & party.
html:

<[B]select name="zone" size="1" id="zone"[/B]>
<option selected="selected" value="Addis Zone1">Addis Zone1</option>
<option value="Addis Zone2>Addis Zone2</option>
<option value="Addis Zone3>Addis Zone3</option>
<option value="Addis Zone4>Addis Zone4</option>
<option value="Addis Zone5>Addis Zone5</option>
</select>
        </label>

      </span></p>

                                       <div align="center">
                              <input name="first" type="radio" checked value="first" />


                                                  <span class="style12">First Name</span>
                              [B]<input type="text" name="firstname" size="20" />[/B]
                                                  <span class="style12">Second Name</span>
                             [B] <input type="text" name="secondname" size="20" />[/B]
                                                  <span class="style2">Party Status
                                                 [B] <input type="text" name="party" size="20" />[/B]
        </span>
                                                  </div>

if it's like this i wrote the php code also but it didn't work for me.

<?php
if ($zone == "zone")
{
$result=mysql_query("select zone,firstname,middlename,party from candidate where $zone='$_POST[zone]'") or
die (mysql_error());
while ($row=mysql_fetch_array($result))
{
echo '$firstname='$row[firstname]';
echo '$firstname='$row[firstname]';
echo '$party='$row[party]';

}
else
exit;
}

plzz check it out..

how can i display the next row data of the same zone by looping?...

I think u didnot open the database connection,so first open the database connection like

$con=mysql_connect("localhost","root","");
        if(!$con)
        {
        die('could not connect: ' . mysql_error());
        }
                                 mysql_select_db("dbname",$con);

next step enter the result and echo stmts

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.