Advertisement
michaelyuen

Untitled

Mar 30th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.82 KB | None | 0 0
  1. <?php
  2. mysql_connect("localhost" , "root" , "") or die("not connect");
  3. mysql_select_db("polic2") or die("not be found");
  4.  
  5. if(isset($_POST['update'])) {
  6.     $edit_record = $_GET['edit_form']; // changed to $edit_record;
  7.     $name1 = $_POST['nameP1'];
  8.     $addressP1 = $_POST['address1'];
  9.     $ageP1 = $_POST['age1'];
  10.     $telP1 = $_POST['tel1'];
  11.     $jobP1 = $_POST['job1'];
  12.     $tawanP1 = $_POST['tawan1'];
  13.     $baseP1 = $_POST['base1'];
  14.     $query1 = "update data set uname='$name1' , uaddress='$addressP1' , uage='$ageP1' ,
  15.     utel='$telP1' , ujob='$jobP1' , utawan='$tawanP1' , ubase='$baseP1'
  16.     where id='$edit_record'"; // changed to $edit_record;
  17.     if(mysql_query($query1)) {
  18.         echo "<script>window.open('view.php?updated=record has been updated','_self')</script>";
  19.     }
  20. }
  21.  
  22. if (ISSET($_GET['edit'])) {
  23.     $edit_record = $_GET['edit'];
  24. }
  25.  
  26. $query = "select * from data where id = '$edit_record'";
  27. $run=mysql_query($query);
  28. while($row=mysql_fetch_array($run)) {
  29.     $edit_id=$row['id'];
  30.     $e_name=$row[1];
  31.     $e_address=$row[2];
  32.     $e_age=$row[3];
  33.     $e_tel=$row[4];
  34.     $e_job=$row[5];
  35.     $e_twana=$row[6];
  36.     $e_base=$row[7];
  37. }
  38. ?>
  39. <html>
  40. <head>
  41. <title>Update data information</title>
  42. </head>
  43. <body>
  44. <form method='post' action='edit.php?edit_form=<?echo $edit_id;?>'>
  45. <table width="500" border="3" align='center'>
  46. <tr>
  47. <th bgcolor='yellow' colspan='5'>-:گۆڕانکاری کردنی زانیارییەکان</th>
  48. </tr>
  49. <tr>
  50. <td align='right'><input type='text' name='nameP1' value='<?php echo $e_name;?>' />
  51. </td>
  52. <td align='right' > ناوی سەرپێچیکار</td>
  53. </tr>
  54. <tr>
  55. <td align='right'><input type='text' name='address1' value='<?php echo $e_address;?>'/>
  56. </td>
  57. <td align='right'> شوینی نیشتەجێبوون</td>
  58. </tr>
  59. <tr>
  60. <td align='right'><input type='text' name='age1' value='<?php echo $e_age;?>' />
  61. </td>
  62. <td align='right'> تەمەن</td>
  63. </tr>
  64. <tr>
  65. <td align='right'><input type='text' name='tel1' value='<?php echo $e_tel;?>'/>
  66. </td>
  67. <td align='right'> ژمارەی مۆبایل</td>
  68. </tr>
  69. <tr>
  70. <td align='right'><input type='text' name='job1' value='<?php echo $e_job;?>'>
  71. </td>
  72. <td align='right'> کار</td>
  73. </tr>
  74. <tr>
  75. <td align='right'><input type='text' name='tawan1' value='<?php echo $e_twana;?>' />
  76. </td>
  77. <td align='right'> سەرپێچی</td>
  78. </tr>
  79. <tr width='500'>
  80. <td align='right'>
  81. <select name='base1'>
  82. <option value='<?php echo $e_base;?>'>
  83. <?php echo $e_base;?>
  84. </option>
  85. <option value='ranya'>ڕانیە</option>
  86. <option value='qaladzy'>قەلادزێ</option>
  87. <option value='chwargwrna'>چوارقورنە</option>
  88. <option value='hajyawa'>حاجیاوا</option>
  89. </select>
  90. </td>
  91. <td align='right'> بنکەی دەستگیرکردن</td>
  92. </tr>
  93. <tr>
  94. <td align='center' colspan='5'>
  95. <input type='submit' name='update' value='گۆڕانکاری' />
  96. </td>
  97. </tr>
  98. </table>
  99. </form>
  100. </body>
  101. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement