Step 1 :
Signup to Google Recaptcha and get the public and private key.
Step 2 :
Make a Model named CaptchaResponse in Model folder and add the given code below.
Signup to Google Recaptcha and get the public and private key.
Make a Model named CaptchaResponse in Model folder and add the given code below.
public function DelContact($field,$val)
{
$db = new ContactModel();
$db->where($field,$val)->delete();
return redirect()->to(site_url('admin/contact'));
}
<a href="<?php echo
site_url('admin/DelContact/ID/123'); ?>" onclick="return
confirm('Are you sure to delete this record')">
<?php
namespace App\Models;
use CodeIgniter\Model;
class ContactModel extends Model
{
protected $table='holywebcontact';
protected $primaryKey = 'ID';
protected $allowedFields = ['ID', 'Name', 'Phone', 'Message', 'CreatedDate'];
}
<?php
namespace App\Controllers;
use App\Models\ContactModel;
class Home extends BaseController
{
public function dataread()
{
$data['title'] = 'DB Get Demo';
$crudModel = new ContactModel();
$data['user_data'] = $crudModel->findAll();
return view('tmp2', $data);
}
}
$data["model"]=$album->where('AlbumID', $aid)->findAll();
<?php
foreach ($model as $item)
{
echo $item["ID"] . "," . $item['Name'] . "<br>";
}
?>
Read Basics of Entity Framework on my previous post for understand this example.
Date Save Code
dbConnection db = new dbConnection();
db.Bill.Add(data);
db.SaveChanges();