CRUD with PDO and OOP PHP #3 - Create Post

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] welcome back right in the previous video we have already showing the data from the database in this page right so now what we are gonna do is make this form work so we can add pose and when we click the add pose we have a new post in here let's open the code what we have from the last video and make it appear so let's check for the pose for the form I mean just the form basically when it is when we click the add + button to add action pose dot process we need to give a method the set pause alright so now save and when we put the browser so reload and when we click the create polls and just data in here let's add pose and it's going to be equal to the postal process the PSB and it's gonna be error because we don't have yet files name is gonna be pose dot process PHP all right so in here we need to do this open negate attack and pro firsts include the auto load class which is includes class dot dance toe load dot and dot PHP alright so now we need to instance yet new object owes they're gonna be equal to new pose right it's gonna be from this class okay all right so now is just check somebody click the submit the ed post right here we want to do something right so we need to using his set it's gonna be posed if we get the submit to where's my index okay when we get the oh we don't sand anything here so that's that name is gonna be equals to submit if somebody clicked the submit we need to do something in here right so I just just want to show you guys I want to just print our toes alright so safe and let's the browser just reload create pose and random theta and when we at pose we get an array again put course title you get post content and post outer now get a subject as well alright so far so that we store everything which is a title and the variable alright so let's create a variable called title and then we and we want to say this pose so let's copy the face and get arrested right so in here will disappear is great call this pose right here and we need to call method okay the method is gonna be a pose but no we don't have yet that okay so I don't have yet I'd post my dot so let's create that in here okay so public at polls and here to support make sure at hitting new post okay just for make sure it's mark so let's go to the browser and reload now when we create polls and just random content and everything random and we have undefined index index oh yeah basically we we send name post title post content post outer can't forget the post basically alright so in here let's post title post s content oh yes after okay so let's take a look again when we create pose a pose and have any new post which is from here all right so now SQL statement so we insert the table name we should be posed right you need to insert something imposed and we doing insert this just title and body and the pipe is outer okay and the value is should be Chris and Mark whistle aah whistle mark yes three time right just this this question mark which is represent what we want but we are gonna just just similar like a variability so let's create a variable called Stefan it's gonna be what we call the connect method from the DBE class right so neck right here and prepare gonna pay since equal right here and finally gonna execute their out execute and instead of execute it's gonna be a represent this question mark okay for the first question mark title and for the second question to do is body and and we get this title and body and author is gonna be from this parameter yeah that's doing here title body and alter all right so now safe so that PHP and in here we need to send this panel body and outer as well so let's do that title body water okay now save so let's take a look back to index and reload and let's try we got an error all right here yeah you forget the semicolon so reload that again okay so let's create you post get set to pose to the content is gonna be this is post to and author is should be my name all right John so at pose and we don't have anything but as you can see in right here and I reload we get a new post or I post to and the body and the outer and when we back to the index and reload we have a to pose really awesome right but I want to when we great click at post is gonna be automatically indirect in index just want to make sure this what I would use say pose this random text and let's that look in here what we are gonna use we are gonna use this so let's copy that and go to the code in here quiet so let's change that to alright so I hope that work so now say it's back to the browser get so create polls and itches random and pose and it's gonna be back to dead yeah that's all right so let's uncomment out so we want to do is just add a new pose and it should be poster II and the content is this is post three and after is gonna be spin it alright so when I click the add pose you can see in here it's gonna be automatically good to the index but I want to add margin so we have a space here so let's start in here that's great margin top two for save and let's look balut now you have space alright so yeah I think that's it guys for this video we can create pose and showing the pose in index right here okay so for the next video work yes so we can edit title and podium or the outer as well so I think that's it's for this video bye
Info
Channel: Cand Dev
Views: 1,920
Rating: undefined out of 5
Keywords:
Id: GLAMjmgziYo
Channel Id: undefined
Length: 15min 5sec (905 seconds)
Published: Thu Jan 30 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.