Change MySQL value via email

Viewed 101

I have a PHP/HTML form which stores values to MySQL database. I do the insert execution

$sql = "
INSERT INTO hotel_nights 
  (name, attribute, hotel, availability, cost, date_in, date_out, stays, people, rooms, note, user) 
VALUES 
  ('$name', '$attribute', '$hotel', '$availability', '$cost', '$date_in', '$date_out', '$stays', '$people', '$rooms', '$note', '$user')
";

and then I send an approval email via phpmail.

Is there any way on approval email to have links/action buttons which will change one MySQL field value? A yes or no case where will change value to 1 or 0

1 Answers

In phpmailer (i think taht what you use) you can add html and inside the html you can make link to send to your site with confirm button when clicked the value changes like:

$mail->Body = '<p>Please click to confirm 
<a href="http://yoursite.com/page/action?email='.$email.'">http://yoursite.com/page/action?email=' . $email. '</a>
</p>';

i think that is the solution for your problem (there is more ways to do it)
Hope i was clear

Related