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.

<[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>


                                       <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]

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

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]';


plzz check it out..

Edited 3 Years Ago by mike_2000_17: Fixed formatting

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

        die('could not connect: ' . mysql_error());

next step enter the result and echo stmts

Edited 3 Years Ago by Dani: Formatting fixed

This article has been dead for over six months. Start a new discussion instead.