SHARE
    TWEET
    Guest User

    Untitled

    a guest
    Jun 6th, 2015
    150
    0
    Never
    Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
    PHP 2.19 KB | None | 0 0
    1. <?
    2. include "init.php";
    3. $id = trim( $_POST["id"] );
    4. if( $id != "" )
    5. {
    6. // Is postback
    7. $name = trim( $_POST["name"] );
    8. $address = trim( $_POST["address"] );
    9. $email = trim( $_POST["email"] );
    10. $phone = trim( $_POST["phone"] );
    11. $name = utf8_encode($name);
    12. $address = utf8_encode($address);
    13. $email = utf8_encode($email);
    14. $phone = utf8_encode($phone);
    15. $name = $conn->real_escape_string($name);
    16. $address = $conn->real_escape_string($address);
    17. $email = $conn->real_escape_string($email);
    18. $phone = $conn->real_escape_string($phone);
    19. $sql = "UPDATE sct_schools SET name='".$name."', address='".$address."', email='".$email."', phone='".$phone."' WHERE id=".$id.";";
    20. //echo $sql;
    21. if( $conn->query($sql) === TRUE )
    22. {
    23. header('Location: showschool.php?id='.$id);
    24. die();
    25. }
    26. else
    27. {
    28. die("Error in update school information query: ".$sql);
    29. }
    30. }
    31. include "header.php";
    32. ?><h1>Rediger skole</h1><?
    33. $sql = "SELECT * FROM sct_schools WHERE id=".$_GET["id"].";";
    34. $result = $conn->query($sql);
    35. if( $result->num_rows > 0 )
    36. {
    37. $school = $result->fetch_assoc();
    38. ?>
    39. <form action="editschool.php" method="post">
    40. <input type="hidden" name="id" id="id" value="<? echo $_GET["id"]; ?>"/>
    41. <table class="form">
    42. <tr>
    43. <th>Skole/institution</th>
    44. <td><input type="text" name="name" id="name" value="<? echo htmlspecialchars(utf8_decode($school["name"])); ?>"/></td>
    45. </tr>
    46. <tr>
    47. <th>Adresse</th>
    48. <td><textarea rows="5" name="address" id="address"><? echo htmlspecialchars(utf8_decode($school["address"])); ?></textarea></td>
    49. </tr>
    50. <tr>
    51. <th>E-mail</th>
    52. <td><input type="text" name="email" id="email" value="<? echo htmlspecialchars(utf8_decode($school["email"])); ?>"/></td>
    53. </tr>
    54. <tr>
    55. <th>Telefon</th>
    56. <td><input type="text" name="phone" id="phone" value="<? echo htmlspecialchars(utf8_decode($school["phone"])); ?>"/></td>
    57. </tr>
    58. <tr>
    59. <th></th>
    60. <td><input type="submit" value="Gem"/><button onclick="location.href='mergeschools.php?id=<? echo $id ?>';">Flet</button></td>
    61. </tr>
    62. </table>
    63. </form>
    64. <?
    65. }
    66. include "footer.php";
    67. ?>
    Advertisement
    Add Comment
    Please, Sign In to add comment
    Public Pastes
    We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
    Not a member of Pastebin yet?
    Sign Up, it unlocks many cool features!

    AltStyle によって変換されたページ (->オリジナル) /