0

My instructor set us up with some default framework that we're supposed to use to develop a database/website project. We're using Twig, and I'm not sure how to execute an INSERT within a Twig file, but the answer seems to be: you can't

We're supposed to, on the click of a link, insert something into the database. How can I achieve this? I'm not sure how to begin, and similar questions I've found so far just have answers with links to various twig documentation sites without any particular direction article wise, so I'm wondering what the way to achieve this is...

  • 2
    As you said, you can't and you shoudln't. `Twig` is a template engine, meaning it is used for outputting data, not modifying it. The only proper way to do this is to use ajax and let another controller handle the insert – DarkBee Apr 30 '17 at 15:59
  • OK so what is a solution to what I'm trying to do? – Natalie Spatharakis Apr 30 '17 at 16:15
  • I don't know what Ajax is and I only have a best guess as to what my controller is -- she never taught us anything in this per se. It's an online course and she just kind of gave it to us to figure out. Any details on how to go about this would be much appreciated – Natalie Spatharakis Apr 30 '17 at 16:16
  • http://stackoverflow.com/a/9436594/446594 – DarkBee Apr 30 '17 at 16:29

0 Answers0