WEBVTT

00:00.320 --> 00:03.530
I will call you back again to another lecture in PHP.

00:03.530 --> 00:09.290
And in this video lecture we go ahead and look at the checkboxes.

00:15.920 --> 00:19.310
So we have been able to discuss our arrays.

00:19.310 --> 00:26.510
And from the knowledge of whatever we've learnt from arrays we're going to convert that to see the application

00:26.510 --> 00:29.360
of arrays in checkboxes.

00:29.390 --> 00:32.300
Now let me go ahead and create the form.

00:32.300 --> 00:35.300
I'm going to start by creating a form right in here.

00:35.330 --> 00:39.650
So let me go ahead and I say this is a form I'll go ahead and close my form.

00:40.010 --> 00:42.710
So and that is closed.

00:42.710 --> 00:51.350
And now I will go right inside the form and give it an action where the sites dot PHP which is a file

00:51.380 --> 00:53.660
that is going to act on this.

00:53.690 --> 00:56.060
Now we're going to use a method.

00:56.060 --> 01:01.310
And that method continues right in here is going to be the post method.

01:01.310 --> 01:05.540
So go ahead and use the post method.

01:05.930 --> 01:11.120
So I told you, after we discuss the post method, that henceforth we are going to be using the post

01:11.120 --> 01:13.370
method and no longer the Get method.

01:13.400 --> 01:16.610
Now let's go ahead and discuss about cars.

01:16.670 --> 01:20.510
So let me go ahead and say we have cars like our Toyota.

01:20.510 --> 01:26.690
We have Nissan, we have Peugeot, we have Tesla and so on.

01:26.690 --> 01:34.880
So let me go ahead and create this as a chat box that only when I click on any of the cars is going

01:34.910 --> 01:35.810
to print it out.

01:35.810 --> 01:39.110
And we're going to use just an array called cars for this.

01:39.140 --> 01:40.700
Now let's go ahead and see.

01:40.700 --> 01:43.370
The first one we have is a Toyota.

01:43.370 --> 01:44.870
So I'm just giving a prompt.

01:44.870 --> 01:48.800
And the next car is going to be Nissan.

01:48.800 --> 01:53.840
So the next car is going to be Tesla.

01:53.840 --> 02:00.440
And the the next car we're going to talk about I don't know more about this.

02:00.440 --> 02:04.580
Just kind of see because all right.

02:04.580 --> 02:10.290
So no after then for each of these cars we are going to input a checkbox.

02:10.290 --> 02:13.680
So how do you add a checkbox to a task like having to click on Twitter?

02:13.710 --> 02:21.150
So if we want to add a checkbox to that, you go ahead and put an input and the type of the input is

02:21.150 --> 02:23.970
going to be a checkbox.

02:24.000 --> 02:26.400
Oh, so let's go back.

02:26.400 --> 02:28.890
And this is the A checkbox.

02:28.920 --> 02:29.490
All right.

02:29.520 --> 02:32.820
Now after an input you got to give it a name.

02:32.820 --> 02:35.880
And that is where the variable name comes.

02:35.880 --> 02:40.170
So the name is going to be is going to be the variable name.

02:40.200 --> 02:42.180
Now let's go ahead and name this.

02:42.180 --> 02:49.770
And I'm going to see this in our variable cause so this is another way I mean so the name is going to

02:49.770 --> 02:50.850
be the array name.

02:50.850 --> 02:52.680
And that is the cause.

02:52.680 --> 02:57.360
So you go ahead and put a square bracket right in here.

02:57.510 --> 03:02.070
Now you're going to specify inside a read element of this array.

03:02.070 --> 03:04.020
And when you use code value.

03:04.020 --> 03:08.160
And because the output in here is just a prompt.

03:08.160 --> 03:14.820
So the value which is the element that will be specified inside the Inside a reef is going to be to

03:14.850 --> 03:15.360
Utah.

03:17.190 --> 03:17.760
All right.

03:17.760 --> 03:19.530
So that is to Utah.

03:19.560 --> 03:21.120
Go ahead and close this.

03:21.120 --> 03:23.250
And I want to discuss on the next one.

03:23.250 --> 03:29.790
So go ahead and put a brick so that the checkbox move to the next line.

03:29.790 --> 03:32.280
So I'm going to copy whatever I have right in here.

03:32.280 --> 03:38.040
Because what we need this guy and save this and refresh this page I check it out.

03:38.040 --> 03:42.510
So I have to see I have to add a checkbox right in here.

03:42.540 --> 03:44.640
You see that and I can click on that.

03:44.640 --> 03:49.080
So let's go ahead and add a checkbox to Nissan Tesla and Pigeons.

03:49.080 --> 03:53.790
So let's go ahead without wasting much time and copy whatever we have right in here.

03:53.790 --> 03:55.860
And then go down here.

03:55.860 --> 04:01.050
And then I paste that and change the value because that is the element name.

04:01.050 --> 04:06.420
And now let's go ahead and name this to be Nissan.

04:06.420 --> 04:11.160
So remember that this is just a prompt just to show out where you're selecting why.

04:11.190 --> 04:18.460
The value right in there is what actually performs and show us what we are going to print out.

04:18.490 --> 04:19.210
All right.

04:19.240 --> 04:22.330
Now let's go ahead and move to the next one.

04:22.330 --> 04:26.500
And I'll change that to Tesla.

04:27.340 --> 04:29.980
We're going to change this to Tesla.

04:35.410 --> 04:36.580
Right now.

04:36.940 --> 04:40.090
We'll go to the next one and type in Bitcoin.

04:46.870 --> 04:48.760
So we have number two dudes.

04:48.790 --> 04:50.230
Let's go ahead and save this again.

04:50.260 --> 04:51.940
I'll refresh this and check it out.

04:51.970 --> 04:54.430
So we have our Toyota.

04:54.430 --> 04:56.230
We have our Nissan.

04:56.230 --> 04:58.510
We have Tesla and we have pictures.

04:58.540 --> 05:00.640
You can see that can actually select that.

05:00.670 --> 05:02.290
Now we'll go ahead and refresh this.

05:02.320 --> 05:06.700
Now there's something important like I told you the first one here.

05:06.730 --> 05:09.370
You can be able to give them different index.

05:09.400 --> 05:13.930
Remember we're not we didn't arrange this in one file or in one.

05:14.110 --> 05:17.350
The arrays are not just in one variable.

05:17.350 --> 05:20.110
We have a car right in here.

05:20.110 --> 05:21.160
We have car here.

05:21.190 --> 05:21.640
Car here?

05:21.670 --> 05:21.940
What?

05:21.940 --> 05:23.350
Everything is just car.

05:23.350 --> 05:30.220
So if I give this to be index zero, that means if I print this out, index zero is going to be two.

05:30.490 --> 05:34.090
So if I give Tesla to be index zero.

05:34.090 --> 05:36.670
So Tesla will always be printed out.

05:36.670 --> 05:41.380
But if I leave this right in here it means that anyone I select to be printed out.

05:41.410 --> 05:45.280
What if I want to print them out based on number of index?

05:45.280 --> 05:52.780
I can say this is a zero, this is a one, this is two, and so on.

05:54.790 --> 05:58.840
So now let's go ahead and move over to PHP right in here.

05:58.840 --> 06:05.530
And the very first thing we're going to do on that PHP is to create a variable of cars.

06:05.530 --> 06:10.450
Because this is just HTML and it's just a font created right in here.

06:10.480 --> 06:13.750
Now we go over here and I use a dollar sign.

06:13.840 --> 06:21.490
Let me say cars is going to be equal to dollar sign underscore posts.

06:21.520 --> 06:24.770
No we're using post because we used those right in the A.

06:24.800 --> 06:28.370
So if we use git that means we're going to use the Get method right in here.

06:28.460 --> 06:35.600
Now let's go ahead and post in the the name which is right in here.

06:35.630 --> 06:39.500
Which is cause because we're going to use just the same name right in here.

06:39.530 --> 06:42.320
So cause that is really easy.

06:42.980 --> 06:46.310
And then we go ahead and put a semicolon at the end.

06:46.340 --> 06:48.020
Don't ever forget the semicolon.

06:48.050 --> 06:51.950
So now if I want to exit this out so I'm go ahead and say echo.

06:52.310 --> 07:00.680
Uh, don't say underscore cause and uh, you're going to put in the square bracket that this is an array.

07:00.680 --> 07:05.390
And then I'm going to pass in zero and put a semicolon.

07:05.510 --> 07:11.510
So like I told you I'm going to go back here and remove this zeros and ones I put in here.

07:11.510 --> 07:14.570
And that is going to be just the same thing as it is.

07:14.570 --> 07:18.380
So go ahead and save this and let us refresh this.

07:18.770 --> 07:21.320
Go back to class and now grow a podcast.

07:21.350 --> 07:25.850
We're in here because we didn't define crisis on define variable car.

07:26.210 --> 07:26.510
All right.

07:26.660 --> 07:27.840
Let's That's trying to save this.

07:27.840 --> 07:32.730
And let's refresh this so you can see that the arrow is gone.

07:33.270 --> 07:34.800
So I'm sorry about that.

07:34.800 --> 07:38.970
So we have this and we have Tesla right in here.

07:38.970 --> 07:46.110
And uh now if I select this guy and I select PGA and hit on submit I have PGA right in here.

07:46.140 --> 07:51.600
Now if I click on Filter and submit I have data right in here.

07:51.600 --> 07:56.970
And if I go ahead and click on this one I have this one here.

07:57.000 --> 08:00.900
Now this will always print out one at a time.

08:00.900 --> 08:09.090
You can see if I select a Tesla and select budget is going to print out the very first one I selected.

08:09.450 --> 08:12.930
I hit submit and Tesla is printed out.

08:13.380 --> 08:17.100
So anyone is select is going to print that out.

08:17.130 --> 08:24.000
Now if I should go back right in here and say I want to give this as index index one.

08:24.000 --> 08:27.600
So or let me go ahead and say index zero.

08:27.630 --> 08:29.730
Let me give the third one, index zero.

08:29.730 --> 08:33.510
And this guy had done 70s Unrefreshed days.

08:34.830 --> 08:42.900
Now, if I print out this guy right here and I click on this and let's hit on this and print on this,

08:42.930 --> 08:44.670
and you see that.

08:44.670 --> 08:47.280
Now let's go ahead and change that to index one.

08:47.280 --> 08:50.760
And let's go back here and change this to index one.

08:50.790 --> 08:53.520
Save this and refresh.

08:54.060 --> 09:00.900
Now what I have is an error because it says undefined library key one.

09:00.990 --> 09:06.990
But if I should go over to Tesla and submit this, I have Tesla printed out.

09:07.290 --> 09:13.410
And now I'm picking out elements of the index of index one.

09:13.440 --> 09:17.550
Now, if I should go back to Toyota and submit, I have an error.

09:18.030 --> 09:23.040
Can you see that until I go back in here and give Tesla maybe index two.

09:23.070 --> 09:26.820
And now go back right in here and print out index two.

09:26.850 --> 09:29.340
I will save this and refresh this.

09:29.850 --> 09:31.530
So the error will be there.

09:31.530 --> 09:34.170
So go back to Toyota and hit on submit.

09:34.170 --> 09:36.840
And the theatre is printed out.

09:37.230 --> 09:40.620
If I show that to anyone I want, I'm going to have an error.

09:40.650 --> 09:43.260
Now let's go back and leave that at zero.

09:43.260 --> 09:46.950
And, uh, so you can be able to give them different index.

09:46.950 --> 09:55.980
But they are regardless of that, once you put in cause index zero it co-head and uh worked fine now

09:55.980 --> 09:59.100
so it can be able to see that that works out fine.

09:59.100 --> 10:00.780
So you can see that.

10:00.780 --> 10:05.790
So anyone is select the very first one is select is going to be printed out for you.

10:05.790 --> 10:09.450
So in this way you can be able to use uh checkboxes.

10:09.450 --> 10:14.280
So this is just an introductory part of checkboxes in uh PHP.

10:14.310 --> 10:14.880
All right.

10:14.910 --> 10:19.230
So we can begin to do projects that uh gets heavier.

10:19.290 --> 10:21.540
Uh, we're going to modify that more.

10:21.540 --> 10:24.480
So we're just introducing this at this point.

10:24.480 --> 10:27.300
And I believe that you understand something here.

10:27.300 --> 10:31.890
So if you have any questions on this you can use the question and answer section.

10:31.890 --> 10:34.710
And I'm going to get back to you as soon as possible.

10:34.740 --> 10:35.640
Thank you so much.

10:35.640 --> 10:39.060
And I'm going to see you in the next video lecture.
