# Using Mautic for a petition. How can I

**URL:** https://forum.mautic.org/t/using-mautic-for-a-petition-how-can-i/22612
**Category:** General Discussion
**Tags:** development
**Created:** [February 6, 2022, 10:18pm UTC](https://forum.mautic.org/t/using-mautic-for-a-petition-how-can-i/22612 "2022-02-06T22:18:09Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![johnwick](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/johnwick/32/3279_2.png) [@johnwick](https://forum.mautic.org/u/johnwick)
#### Post date: [February 6, 2022, 10:18pm UTC](https://forum.mautic.org/t/using-mautic-for-a-petition-how-can-i/22612/1 "2022-02-06T22:18:09Z")

</div>

I’m using Mautic for an online petition and have it all set up and working great.

I’m looking for a method to show how many records have been submitted and the target number we’re looking to capture on the landing page displaying something like a horizontal thermometer.

Does anyone have advice on how to go about adding that functionality to Mautic?

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [February 7, 2022, 11:25am UTC](https://forum.mautic.org/t/using-mautic-for-a-petition-how-can-i/22612/2 "2022-02-07T11:25:40Z")

</div>

With super simple coding you can do it.  
Just count the submissions in the right form and push it out on your website. You can embed that number.

---

<div class="post-metadata">

### Author: ![johnwick](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/johnwick/32/3279_2.png) [@johnwick](https://forum.mautic.org/u/johnwick)
#### Post date: [February 11, 2022, 5:32am UTC](https://forum.mautic.org/t/using-mautic-for-a-petition-how-can-i/22612/3 "2022-02-11T05:32:24Z")

</div>

Hey Joey,

I’m totally green coding on Mautic, but I was able to achieve the query outside of Mautic, but when I place the code into the landing page, PHP is getting disabled by the builder.

```auto
<!--?php
$sql = "SELECT * FROM `form_submissions` WHERE `form_id`=5;";
if ($result=mysqli_query($conn,$sql)) {
$rowcount=mysqli_num_rows($result);
echo "The total number of rows are: ".$rowcount; 
}
?-->

```

Any ideas on circumventing that?

---

<div class="post-metadata">

### Author: ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)
#### Post date: [February 11, 2022, 11:00pm UTC](https://forum.mautic.org/t/using-mautic-for-a-petition-how-can-i/22612/4 "2022-02-11T23:00:12Z")

</div>

I do not think builder allows putting php code into builder.

What I would probably do in your situation is:

- create custom php script and place it on your server so its accessbile from the web (as far as I can tell you already started :))
- on your landingpage where you have thermometer I would create a simple JS script that makes request to this php script you created earlier
- the php should return number of records in the form and you can now use that info to display thermometer correctly.

---

<div class="post-metadata">

### Author: ![johnwick](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/johnwick/32/3279_2.png) [@johnwick](https://forum.mautic.org/u/johnwick)
#### Post date: [February 11, 2022, 11:38pm UTC](https://forum.mautic.org/t/using-mautic-for-a-petition-how-can-i/22612/5 "2022-02-11T23:38:41Z")

</div>

Thanks for the suggestion, that points me in the right direction. It’s a bit over my pay grade, but I’ll look into it deeper. I do have the PHP script done and found that Mautic prevents calling PHP directly through the .htaccess file.

---

<div class="post-metadata">

### Author: ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)
#### Post date: [February 12, 2022, 12:54am UTC](https://forum.mautic.org/t/using-mautic-for-a-petition-how-can-i/22612/6 "2022-02-12T00:54:54Z")

</div>

No problem. Let me know if you get stuck and need additional help.

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [February 13, 2022, 5:32pm UTC](https://forum.mautic.org/t/using-mautic-for-a-petition-how-can-i/22612/7 "2022-02-13T17:32:58Z")

</div>

You can place it in your mautic.ltd/petition/ folder and name it index.php  
You can call index.php files 🙂
