Welcome Guest, Not a member yet? Register   Sign In
Need Help with Delete email Function
#1

[eluser]vincej[/eluser]
Hi - I'm sending out standard emails with the CI email class - it all works very well. My emails have a link at the bottom which allows the customer to un-subscribe. The link calls a delete()function within a controller which in turn talks to the DB via a model. All Good. Everything works.

The only problem is that when it calls the delete()function, the customer web browser opens a blank page ! Is it becasue it is inside a CI_ Controller ?? What should I be doing in order that it deletes quietly in the background without opening a page in the browser ??

Many thanks for all your ideas !


web page link: (for some curious reason this site will not reproduce: '$list['id']' in the link below ! )

Code:
<a href='". site_url()."/admin/customer/delete/".$list['>Unsubscribe and De-activate Account </a>

Controller:

Code:
class Customer extends CI_Controller {
public function Customer(){
   parent::__construct();
  }

function delete($id){
$this->MCustomer->deletecustomer($id);}

#2

[eluser]CroNiX[/eluser]
So you want a link that doesn't do what a link is supposed to do, which is to go to the location in the href?

Why don't you just have a simple "successfully unsubscribed" view that loads when the visitor goes there so there isn't a blank page and it acknowledges to the user that the action was performed? That would be user-friendly.
#3

[eluser]vincej[/eluser]
Thanks CroxNix - sometimes the obvious defeats us !

I'll give it a try !
#4

[eluser]Mauricio de Abreu Antunes[/eluser]
You can call your controller and show a view, telling to user "Your account has been deleted" in success case.
#5

[eluser]InsiteFX[/eluser]
Or redirect back to your Home page.
#6

[eluser]Unknown[/eluser]
Hi vincej,

For deleting the data we have use the form in view which has hidden field containing the deleted id insite. On click of delete button/link the javascript method get called which submits the delete form by post method in the same controller same method you can check for posted deleted id and fire the delete query at there. By doing all this you can stay on same page and you data can also be deleted.

Let me know if there is any doubt.


Thanks,
Nilesh G. Pangul
#7

[eluser]Dhanapal MCA[/eluser]
[quote author="vincej" date="1329329445"]Hi - I'm sending out standard emails with the CI email class - it all works very well. My emails have a link at the bottom which allows the customer to un-subscribe. The link calls a delete()function within a controller which in turn talks to the DB via a model. All Good. Everything works.

The only problem is that when it calls the delete()function, the customer web browser opens a blank page ! Is it becasue it is inside a CI_ Controller ?? What should I be doing in order that it deletes quietly in the background without opening a page in the browser ??

Many thanks for all your ideas !


web page link: (for some curious reason this site will not reproduce: '$list['id']' in the link below ! )

Code:
<a href='". site_url()."/admin/customer/delete/".$list['>Unsubscribe and De-activate Account </a>

Controller:

Code:
class Customer extends CI_Controller {
public function Customer(){
   parent::__construct();
  }

function delete($id){
$this->MCustomer->deletecustomer($id);}

[/quote]


Check




Theme © iAndrew 2016 - Forum software by © MyBB