Custom Search and Display Form (w/PHP)

By: James Peary | Asked: 04/19/2023
ForumsCategory: General questionsCustom Search and Display Form (w/PHP)
James Peary asked 1 year ago

Hi, looks like a lot of great people here. I own a license of Formidable and I would like to use it for a custom search form and then display the results.

Does anyone know if this is possible with Formidable Forms Pro? Would it need custom CSS format coding? I've done a lot of searching about this and couldn't find anything.

I may be be totally wrong here, but I was thinking the Formidable Form could supply the following "Redirect" under Actions or similar:

mywebsite/search.php?serial=Z68hptf3

 

Then my search.php script may output something like:

Serial:Z68-HPTF3
LogoURL:mywebsite\logos\sunset.png
Company:Sunset Computer Corp.
Country:United States
WarrantyStart:April 2020
WarrantyEnd:May 2024
etc.

I've attached an example form image with results I threw together in Photoshop. Thank you!

 

Attachments
Bobby Clapp replied 1 year ago

Just trying to understand... Formidable forms could be designed to output exactly what you have in the attachment. Why are you pushing everything to the custom php?

James Peary replied 1 year ago

Sorry, I should've been more clear. Some results are or will be based on custom calculations in my PHP script, so it's not simply looking up data in tables. I'm also needing to "massage" and filter the input so that if someone formats the input strangely, the PHP script can interpret and ignore certain characters, make corrections, etc. I also want to log searches in specific ways and prevent too many searches from a single IP address per day, geolocation, etc. It's basically so I can have full control. Am I going about this the wrong way?

I *could* probably use my own PHP scripts for a search box, but I like how Formidible integrates into WP and other features.

2 Answers
Victor Font answered 1 year ago

Redirecting to a script could work. When you do that, you'll be transferring control from Formidable to the script. How do you plan to display the results from your search script? Another approach you could try is Ajax to run your script. You wouldn't have to redirect to anything and stay on the same page to display your results.

James Peary replied 1 year ago

> Redirecting to a script could work. When you do that, you'll be transferring control from Formidable to the script.

Yes thank you, that's what I thought too. Maybe that's not the way to go. ?

> How do you plan to display the results from your search script?

I guess I was thinking Formidable could format the results. Am I wrong about that?

> Another approach you could try is Ajax to run your script. You wouldn't have to redirect to anything and stay on the same page to display your results.

I would definitely like to use Ajax so it all stays on the same page. Do you mean by using the Redirect feature to run my PHP script and then my PHP script would also be responsible for formatting & outputting the results under the search box?

Victor Font replied 1 year ago

You can format anything you want through select Formidable hooks. Formidable can't format anything if you use your custom script and do your processing outside of Formidable. How will send the data back to Formidable?

Ajax works completely differently. With Ajax you monitor your fields with jQuery and trigger a REQUEST to your custom Ajax PHP script that returns the results to the browser in JSON. Once you receive the JSON RESPONSE, you continue processing the JSON in you jQuery function and populate whatever fields you want in the form. When the form is submitted, all the processing is already done for you.

James Peary replied 1 year ago

Thank you so much Victor! I've been sick the past few weeks. 🙁

This sounds just like what I'm wanting. Is there an example of this somewhere?

James Peary answered 1 year ago

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right