typeobjectfield.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. include "auth.php";
  3. if(isset($_POST['machine'])){
  4. $idmachine =$_POST['machine'];
  5. echo"
  6. <form action='?act=typeobject' method='POST'>
  7. <input type='hidden' name='hiddenid' value='$idmachine'>
  8. <select id='machinetypelink' name='machinetypelink'>
  9. <option value='typetext'>text</option>
  10. <option value='typeint'>int</option>
  11. <option value='typefloat'>float</option>
  12. <option value='typebinary'>binary</option>
  13. </select>
  14. <input type='text' name='namelink' id='namelink'>
  15. <input type='text' name='textlink' id='textlink'>
  16. <input id='machinebut' type='submit' name='machinebut' value='Добавить поле'>
  17. </form>
  18. <form action='?act=typeobject' id='my_form' method='POST'>
  19. <input type='hidden' name='hiddenid' value='$idmachine'> ";
  20. $query = mysqli_query($link,"select * from type_detals where id_type='$idmachine'");
  21. while ($res = mysqli_fetch_array($query)) {
  22. $nameid=$res['id'];
  23. $namedetals=$res['name_detals'];
  24. $type=$res['type'];
  25. $typeid="type".$nameid;
  26. $count=$res[$type];
  27. echo "<select id='$typeid' name='$typeid'>";
  28. switch($type)
  29. {
  30. case 'typetext' : echo"
  31. <option value='typetext' selected >text</option>
  32. <option value='typeint'>int</option>
  33. <option value='typefloat'>float</option>
  34. <option value='typebinary'>binary</option>
  35. "; break;
  36. case 'typeint' : echo"
  37. <option value='typetext'>text</option>
  38. <option value='typeint' selected >int</option>
  39. <option value='typefloat'>float</option>
  40. <option value='typebinary'>binary</option>
  41. "; break;
  42. case 'typefloat' : echo"
  43. <option value='typetext'>text</option>
  44. <option value='typeint'>int</option>
  45. <option value='typefloat' selected >float</option>
  46. <option value='typebinary'>binary</option>
  47. "; break;
  48. case 'typebinary' : echo"
  49. <option value='typetext'>text</option>
  50. <option value='typeint'>int</option>
  51. <option value='typefloat'>float</option>
  52. <option value='typebinary' selected >binary</option>
  53. "; break;
  54. default: echo"
  55. <option value='typetext' selected>text</option>
  56. <option value='typeint'>int</option>
  57. <option value='typefloat'>float</option>
  58. <option value='typebinary'>binary</option>
  59. "; break;
  60. }
  61. echo"
  62. </select>
  63. <input id='detals".$nameid."' type='text' name='detals".$nameid."' value ='$namedetals' >
  64. <input id='count".$nameid."' type='text' name='count".$nameid."' value ='$count' >
  65. <a href='?act=typeobject&delete=".$nameid."'><button type='button'>Удалить</button></a>
  66. <br>";
  67. }
  68. echo " <input id='save' type='submit' name='save' value='Сохранить'>
  69. </form>";
  70. }
  71. ?>