Advertisement
Guest User

index.php

a guest
Nov 27th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.35 KB | None | 0 0
  1. <?php
  2. // connect to the database
  3. mysql_connect(**********);
  4.  
  5. // select the database
  6. mysql_select_db(****************) or die("Unable to select database");
  7.  
  8. // run the query and put the results in an array variable called $result
  9. $result = mysql_query("SELECT * FROM Table");
  10. print "<form name='namestoupdate' method='post' action='update.php'>\n";
  11. ?>
  12. <table border="1" cellpadding="10" cellspacing="1" width="10" class="tblListForm">
  13. <tr class="listheader">
  14. <td>ID</td>
  15. <td>Prezime</td>
  16. <td>Ime</td>
  17. <td>JMBG</td>
  18. <td>Odeljenje</td>
  19. <td>Sektor</td>
  20. <td>Izbor</td>
  21. </tr>
  22. <?php
  23. $i=0;
  24. while ($books = mysql_fetch_array($result)) {
  25. if($i%2==0)
  26. $classname="evenRow";
  27. else
  28. $classname="oddRow";
  29. print "<input type='hidden' name='id[$i]' value='{$books['ID']}' />";
  30. ?>
  31. <tr class="<?php if(isset($classname)) echo $classname;?>">
  32. <td><?php echo $books["ID"]; ?></td>
  33. <td><?php echo $books["Prezime"]; ?></td>
  34. <td><?php echo $books["Ime"]; ?></td>
  35. <td><?php echo $books["JMBG"]; ?></td>
  36. <td><?php echo $books["Odeljenje"]; ?></td>
  37. <td><?php echo $books["Sektor"]; ?></td>
  38. <td><?php echo $books["Izbor"]; ?></td>
  39. <td>
  40. <?php
  41.  print "<input type='text' size='40' name='bookinfo[$i]' value='{$books['Ime']}' />"; ?> // <- OVAJ DEO
  42.  </td>
  43. </tr>
  44. <?php
  45. ++$i;
  46. }
  47. print "<input type='submit' value='submit' />";
  48. print "</form>";
  49. mysql_close();
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement