<?php include("connection.php"); if(isset($_REQUEST["sub"])) { $t1=$_REQUEST["city"]; $t2=$_REQUEST["val1"]; if($t1!=-1) { $q="insert into area_master(cityid,area_name)values($t1,'$t2')"; $ex=mysql_query($q,$con); if($ex>0) { $msg="Data is inserted"; } else { $msg="Data is not inserted"; } } } ?> <form action="#" method="post"> <b> <p align="center"> <?php if(isset($msg)) { echo $msg; } ?> </p> </b> <table align="center" border="2"> <tr> <td> <label>City Name</label> </td> <td> <select name="city" size="1"> <option value="-1">--SELECT--</option> <?php include("connection.php"); $q="select *from city"; $res=mysql_query($q,$con); while($row=mysql_fetch_array($res)) { ?> <option value="<?php echo $row[0]; ?>"><?php echo $row[2]; ?></option> <?php } ?> </select> </td> </tr> <tr> <td> <label>Area Name</label> </td> <td> <input type="text" name="val1" size="20"/> </td> </tr> <tr> <td></td> <td> <input type="submit" name="sub" value="Add Area"/> </td> </tr> </table> <h3>Manage Area</h3> <table align="center" border="3" cellpadding="10" cellspacing="10" > <th align="center">City Name</th> <th align="center">Area</th> <th align="center">EDIT</th> <th align="center">DELETE</th> <?php include("connection.php"); $q="SELECT a.area_id,a.area_name,c.cityname from area_master a ,city c where a.cityid=c.cityid"; $res=mysql_query($q,$con); while($row=mysql_fetch_array($res)) { ?> <tr> <td align="center"><?php echo $row[2]; ?></td> <td align="center"><?php echo $row[1]; ?></td> <td align="center"><a href="?id=updatearea&id1=<?php echo $row[0]; ?>">EDIT</a></td> <td align="center"><a href="delarea.php?did=<?php echo $row[0]; ?>" onClick="return confirm('sure do you want to delete?')">DELETE</a></td> </tr> <?php } ?> </table> </form>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more