I have been working on a tp2.0 website developed by the company in 2011 these days. In fact, I am relatively proficient in tp, but that refers to version 3.2. After I looked at the company website code, I felt sad. I found that I don’t even know how to do basic additions, deletions, modifications, and checks. I’ll post the source code and pictures and ask someone to help me figure out what I wrote wrong
Updated again, took screenshots of my website, the additions, deletions, modifications written by the developer, take a look at the bottom. Still not solved, does anyone have a version 2.0 project? Post it and take a look
First of all this is my add method code:
public function add(){
if(isPost){
<code>$model=M('Bcast'); $data['author']=$_POST['author']; $data['title']=$_POST['title']; $data['desc']=$_POST['desc']; $data['url']=$_POST['url']; $data['image']=$_POST['image']; $model->data($data)->add(); $this->display();</code>
}
}
Such a simple piece of code killed me in version 2.0
1: I don’t know where to put $this->display();; after 3.2, I can write this else after not post, but I tried this version, and it can’t be displayed at all
Two: After I added, I originally planned to add success successfully, but after I added it, I clicked on the page and found that it directly showed success, without giving me a chance to fill in the form.
Okay, now let’s talk about the form