• We just launched and are currently in beta. Join us as we build and grow the community.

Contact Information System

ScrollOfYin

Seiyuu Fanatic
S Rep
0
0
0
Rep
0
S Vouches
0
0
0
Vouches
0
Posts
129
Likes
33
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
If you are looking for Contact Information System then you are at the right place. I have a full source code of Contact Information System. This system works on how to add, update, and delete contact information.

We're gonna use INSERT, UPDATE, and DELETE Statement for this system using PDO.
INSERT, UPDATE, and DELETE Statement

INSERT Statement Using PDO

  1. <?php
  2. include

    (

    'db.php'

    )

    ;

  3. $first_name

    =

    $_POST

    [

    'first_name'

    ]

    ;
  4. $last_name

    =

    $_POST

    [

    'last_name'

    ]

    ;
  5. $contact_number

    =

    $_POST

    [

    'contact_number'

    ]

    ;
  6. $email

    =

    $_POST

    [

    'email'

    ]

    ;
  7. $address

    =

    $_POST

    [

    'address'

    ]

    ;

  8. $conn

    ->

    setAttribute

    (

    PDO::

    ATTR_ERRMODE

    ,

    PDO::

    ERRMODE_EXCEPTION

    )

    ;
  9. $sql

    =

    "INSERT INTO tbl_member (first_name, last_name, contact_number, email, address )
  10. VALUES ('$first_name

    ', '$last_name

    ', '$contact_number

    ', '$email

    ', '$address

    ')"

    ;

  11. $conn

    ->

    exec

    (

    $sql

    )

    ;
  12. echo

    "<script>alert('Successfully Added!'); window.location='index.php'</script>"

    ;
  13. ?>

UPDATE Statement Using PDO

  1. <?php
  2. include

    'db.php'

    ;

  3. $get_id

    =

    $_REQUEST

    [

    'tbl_member_id'

    ]

    ;

  4. $first_name

    =

    $_POST

    [

    'first_name'

    ]

    ;
  5. $last_name

    =

    $_POST

    [

    'last_name'

    ]

    ;
  6. $contact_number

    =

    $_POST

    [

    'contact_number'

    ]

    ;
  7. $email

    =

    $_POST

    [

    'email'

    ]

    ;
  8. $address

    =

    $_POST

    [

    'address'

    ]

    ;

  9. $sql

    =

    "UPDATE tbl_member SET first_name ='$first_name

    ', last_name ='$last_name

    ',
  10. contact_number ='$contact_number

    ', email ='$email

    ', address ='$address

    ' WHERE tbl_member_id = '$get_id

    ' "

    ;

  11. $conn

    ->

    exec

    (

    $sql

    )

    ;
  12. echo

    "<script>alert('Successfully Edit The Account!'); window.location='index.php'</script>"

    ;
  13. ?>

DELETE Statement Using PDO

  1. <?php
  2. require_once

    (

    'db.php'

    )

    ;

  3. $get_id

    =

    $_GET

    [

    'tbl_member_id'

    ]

    ;

  4. // sql to delete a record
  5. $sql

    =

    "Delete from tbl_member where tbl_member_id = '$get_id

    '"

    ;

  6. // use exec() because no results are returned
  7. $conn

    ->

    exec

    (

    $sql

    )

    ;
  8. header

    (

    'location:index.php'

    )

    ;
  9. ?>

Form Field

Add Form Field

  1. <form

    method

    =

    "post"

    action

    =

    "add_person_query.php"

    >
  2. <table

    border

    =

    "1"

    cellspacing

    =

    "5"

    cellpadding

    =

    "5"

    width

    =

    "100%"

    >
  3. <tr

    >
  4. <td

    >
  5. <label

    >

    First Name</

    label

    >
  6. </

    td

    >
  7. <td

    width

    =

    "395px"

    >
  8. <input

    type

    =

    "text"

    class

    =

    "text_Box"

    name

    =

    "first_name"

    autofocus=

    "autofocus"

    placeholder=

    "First Name ....."

    required /

    >
  9. </

    td

    >
  10. </

    tr

    >
  11. <tr

    >
  12. <td

    >
  13. <label

    >

    Last Name</

    label

    >
  14. </

    td

    >
  15. <td

    width

    =

    "395px"

    >
  16. <input

    type

    =

    "text"

    class

    =

    "text_Box"

    name

    =

    "last_name"

    placeholder=

    "Last Name ....."

    required /

    >
  17. </

    td

    >
  18. </

    tr

    >
  19. <tr

    >
  20. <td

    >
  21. <label

    >

    Contact Number</

    label

    >
  22. </

    td

    >
  23. <td

    width

    =

    "395px"

    >
  24. <input

    type

    =

    "text"

    class

    =

    "text_Box"

    name

    =

    "contact_number"

    placeholder=

    "Contact Number ....."

    required /

    >
  25. </

    td

    >
  26. </

    tr

    >
  27. <tr

    >
  28. <td

    >
  29. <label

    >

    Email</

    label

    >
  30. </

    td

    >
  31. <td

    width

    =

    "395px"

    >
  32. <input

    type

    =

    "email"

    class

    =

    "text_Box"

    name

    =

    "email"

    placeholder=

    "Email ....."

    >
  33. </

    td

    >
  34. </

    tr

    >
  35. <tr

    >
  36. <td

    >
  37. <label

    >

    Address</

    label

    >
  38. </

    td

    >
  39. <td

    width

    =

    "395px"

    >
  40. <input

    type

    =

    "text"

    class

    =

    "text_Box"

    name

    =

    "address"

    placeholder=

    "Address ....."

    required /

    >
  41. </

    td

    >
  42. </

    tr

    >
  43. <tr

    >
  44. <td

    colspan

    =

    "2"

    >
  45. <a

    >
  46. <button

    type

    =

    "submit"

    class

    =

    "btn_confirm"

    >
  47. Save Data
  48. </

    button

    >
  49. </

    a

    >
  50. </

    td

    >
  51. </

    tr

    >
  52. </

    table

    >
  53. </

    form

    >

Update Form Field

  1. <?php
  2. include(

    'db.php'

    )

    ;
  3. $result =

    $conn->

    prepare("SELECT * FROM tbl_member where tbl_member_id='$ID'");
  4. $result->execute();
  5. for($i=0; $row = $result->fetch(); $i++){
  6. $id=$row['tbl_member_id'];
  7. ?>

  8. <form

    method

    =

    "post"

    action

    =

    "edit_person_query.php<?php echo '?tbl_member_id='.$id; ?>

    ">
  9. <table

    border

    =

    "1"

    cellspacing

    =

    "5"

    cellpadding

    =

    "5"

    width

    =

    "100%"

    >
  10. <tr

    >
  11. <td

    >
  12. <label

    >

    First Name</

    label

    >
  13. </

    td

    >
  14. <td

    width

    =

    "395px"

    >
  15. <input

    type

    =

    "text"

    class

    =

    "text_Box"

    name

    =

    "first_name"

    value

    =

    "<?php echo $row['first_name']; ?>

    " autofocus="autofocus" placeholder="First Name ....." />
  16. </

    td

    >
  17. </

    tr

    >
  18. <tr

    >
  19. <td

    >
  20. <label

    >

    Last Name</

    label

    >
  21. </

    td

    >
  22. <td

    width

    =

    "395px"

    >
  23. <input

    type

    =

    "text"

    class

    =

    "text_Box"

    name

    =

    "last_name"

    value

    =

    "<?php echo $row['last_name']; ?>

    " placeholder="Last Name ....." />
  24. </

    td

    >
  25. </

    tr

    >
  26. <tr

    >
  27. <td

    >
  28. <label

    >

    Contact Number</

    label

    >
  29. </

    td

    >
  30. <td

    width

    =

    "395px"

    >
  31. <input

    type

    =

    "text"

    class

    =

    "text_Box"

    name

    =

    "contact_number"

    value

    =

    "<?php echo $row['contact_number']; ?>

    " placeholder="Contact Number ....." />
  32. </

    td

    >
  33. </

    tr

    >
  34. <tr

    >
  35. <td

    >
  36. <label

    >

    Email</

    label

    >
  37. </

    td

    >
  38. <td

    width

    =

    "395px"

    >
  39. <input

    type

    =

    "email"

    class

    =

    "text_Box"

    name

    =

    "email"

    value

    =

    "<?php echo $row['email']; ?>

    " placeholder="Email .....">
  40. </

    td

    >
  41. </

    tr

    >
  42. <tr

    >
  43. <td

    >
  44. <label

    >

    Address</

    label

    >
  45. </

    td

    >
  46. <td

    width

    =

    "395px"

    >
  47. <input

    type

    =

    "text"

    class

    =

    "text_Box"

    name

    =

    "address"

    value

    =

    "<?php echo $row['address']; ?>

    " placeholder="Address ....." />
  48. </

    td

    >
  49. </

    tr

    >
  50. <tr

    >
  51. <td

    colspan

    =

    "2"

    >
  52. <a

    >
  53. <button

    type

    =

    "submit"

    class

    =

    "btn_confirm"

    >
  54. Save Data
  55. </

    button

    >
  56. </

    a

    >
  57. </

    td

    >
  58. </

    tr

    >
  59. </

    table

    >
  60. </

    form

    >
  61. <?php }

    ?>

Delete Field

  1. <a

    href

    =

    "delete_contact.php<?php echo '?tbl_member_id='.$id; ?>

    ">
  2. <button

    type

    =

    "submit"

    class

    =

    "btn_confirm1"

    onclick

    =

    "return confirm(' Delete Contact ( <?php echo $first_name?>

    ) ? ');">
  3. Delete
  4. </

    button

    >
  5. </

    a

    >

Result:

INSERT Data

add_8.png

UPDATE Data

edit_2.png

DELETE Data

delete_2.png


And, that's it. Kindly click the "Download Code" button below for full source code. Thank very much.

Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.


Download
You must upgrade your account or reply in the thread to view hidden text.
 

452,292

323,526

323,535

Top