46: Insert data into array in PHP – PHP tutorial


Insert data into array in PHP – Learn PHP backend programming. Today we will learn how to insert data into arrays that are either empty or already has data in them.


First of all, thank you for all the support you have given me!

I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!

I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.

I hope you will find it helpful 🙂

Material for this lesson:

Nguồn: https://milchreis.org/

Xem thêm bài viết khác: https://milchreis.org/cong-nghe/


  1. How to update multiple array? In laravel

    Example: you have data like this

    Id 1 invoNo= 500NA. pid=1 qty=30. Customname=ABC

    Id 2 invoNo= 500NA pid=3 qty=300 Customname=ABC

    How to update the data like this, help me the concept in case you can email me emma4082@gmail.com

  2. Hello nice tuts. I HAVE A QUESTION. Related to array, can you explain why we put html input checkbox name= "checkbox [ ] " . How those brackets as key can turn into value in an array? I dont get it. Thanks pal you awesome.

  3. thanks for that highlight thier but have one qn : how do i get to insert into another array like $emparray['movies'][] = array( "casts" => array()) ?????

  4. I am trying to insert my <select name="subscriptionplan1"> into the database but for some reason, it won't insert it.

  5. Good video, but it needs to progress to something beyond bare elementary. I am struggling to solve a problem and cant find one video

  6. the array wont push, still 1 data only, exactly like ur code
    if(isset($_POST['user']) && isset($_POST['pass']))
    $user = array();
    $pass = array();
    array_push($user, $_POST['user']);
    array_push($pass, $_POST['pass']);
    <form action="test.php" method="post">
    <input type="text" name="user">
    <input type="password" name="pass">
    <input type="submit" name="submit">

  7. Is it required to use empty array and why we use them, I can't understand the way to use empty array $array = [] ?

  8. great tuts, thnks….i want to ask you something.i get done most of the free php tutorials from youtube and all finish in some way at the same level…..what's next?what should we work on to go the php a level further?

  9. Hi Daniel, I'm new to your channel and I think you are the best teacher around here. I'm recently working on a website for my school project and your tutorials are indeed helping a lot. Working on my website with JavaScript I steped on a problem for which I did not find any explenation to solve. I basically want to be able to click on a link which than sets an image without reloading the page. If I just click a link with an onclick event the image shows of on a blanc website. I really hope you can help me on this.


Please enter your comment!
Please enter your name here