Need to add additional php code to...

User 2713849 Photo


Registered User
4 posts

I need to query the database to retrieve values to determine if a field is hidden or not. I have X amount of flights available and when they are fully taken, I need to hide the option to select a flight. Which file would i need to put this code in?
User 10077 Photo


Senior Advisor
1,096 posts

In exported files, you will find the html page that has the form itself. That is where you would apply your customizations. Change the file extension to .php (instead of .html) and then do your coding there. After you make your changes, when you add the form to your page, instead of using the iframe code that WFB provides, you will need to link directly to the form.
ASK ME ANYTHING
I provide personalized help for Coffeecup Users including personal or group training for Site Designer, Web Form Builder and more via Zoom.
Email me at support@uscni.org or call 865-687-7698.

Did you know that Web Form Builder can be used for both simple and complicated forms and that it's not limited to the default fonts and buttons? Take a look at a form we developed for WindowTinting.com.
https://forms.windowtinting.com/forms/w … ppingcart/
User 2713849 Photo


Registered User
4 posts

Hi, Ok great thanks - additionally, I need to hide a certain field based on the query result - where could I put in this code within the actual form fields? I'll need to put in a php condition around the specific field with the form.
User 187934 Photo


Senior Advisor
20,271 posts
Online Now

I do mine this way.
Do you mysql query then I apply the for each loop to an in line style in the head of the page. This way allows you to easily apply it to several different CLASS or ID's.
<style>
<?php
foreach($result as $row) {
echo '.myclass'.$row['mycolumn'].'{';
echo 'display:none;';
echo '}';
}
?>
</style>

otherwise an if statement can do the job.
<style>
<?php
if(isset($myvariable)) {
echo '.myclass'.$row['mycolumn'].'{';
echo 'display:none;';
echo '}';
}
?>
</style>

Now all you need to do is enter the proper CLASS or ID in the area of the form to hide it.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2713849 Photo


Registered User
4 posts

Great thanks Eric. Another question: I need to add in dynamic content within the form below the header. Which file do I edit to add the php code into? Thanks - Is it possible to add in php within form builder in the HTML box?
User 187934 Photo


Senior Advisor
20,271 posts
Online Now

Yes you can add php code to an html box. Any dynamic content driven by php would be added to the myformname.html page.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 10077 Photo


Senior Advisor
1,096 posts

If you add php code to the html page, you need to make sure that either (1) you enable your server to parse php within html pages or (2) rename .html to .php.
ASK ME ANYTHING
I provide personalized help for Coffeecup Users including personal or group training for Site Designer, Web Form Builder and more via Zoom.
Email me at support@uscni.org or call 865-687-7698.

Did you know that Web Form Builder can be used for both simple and complicated forms and that it's not limited to the default fonts and buttons? Take a look at a form we developed for WindowTinting.com.
https://forms.windowtinting.com/forms/w … ppingcart/
User 2713849 Photo


Registered User
4 posts

Hi, I've added this to the HTML element in the form builder:

<script><?php echo "hello world"; ?></script>
<h1>
here
</h1>

Its not resolving any php? Is there something I need to do elsewhere?
User 187934 Photo


Senior Advisor
20,271 posts
Online Now

Make sure your not viewing the form through the iframe code that the form builder provides. Remove the script thats wrapped around it.
otherwise try this.
Add this line to your .htaccess page in the root of your site.
RemoveHandler .html .htm
AddType application/x-httpd-php .php .html .htm
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.