Form handling via my own php script?...

User 2254047 Photo


Registered User
7 posts

Instead of receiving form data back via an email or csv file, is it possible to have the form data handled by my own php script? This would allow me to update an existing database record rather than simply creating a new record. As long as I can get the submitted form values (as either GET or POST, although I'd prefer POST), I can create the handling script.

I tried looking through the code, but it's not clear where I might be able to do it. (I did try changing the file reference in the html file on my site where the form is display, specifying my own php handler. It worked, but the handler appears in the same popup window as the form - but I'd prefer the user was taken instead to a new success page.)

Thanks for any help you may be able to provide. I love Web Form Handler, and the other CoffeeCup Software products I own!
User 187934 Photo


Senior Advisor
20,271 posts

So your only looking to use the form builders fast form building capabilities and want to process the data yourself?
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 2254047 Photo


Registered User
7 posts

Yes, would love to be able to quickly create a form, have the uploaded form gather the input and handle field validation, and then pass the form data via POST.
User 187934 Photo


Senior Advisor
20,271 posts

Here's I did one based on $_REQUEST
What do you like?
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 2254047 Photo


Registered User
7 posts

$_REQUEST is fine too...is there an easy way to accomplish this with Web Form Builder?

Thanks for your help on this!
User 187934 Photo


Senior Advisor
20,271 posts

It's so simple.:cool:
Create your form.
Create you handler using the formbuilders variables which is the name of the element.
Now save your handler with the same name and location as myformname.php.
You basically replacing the OEM myfornname.php with yours.
You can use $_POST also.
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 2254047 Photo


Registered User
7 posts

Eric, thanks for the suggestion, but I can't seem to get that to work. Perhaps you can find the error in my process...

I created an html form called test_form.html and a form handler called test_handler.php. I used Web Form Builder (WFB) to create a simple form (not as a popup), and after the manual export process, I pasted the code into test_form.html. My test_handler.php document just echos the values submitted on the form.

My WFB form is called test, and I uploaded the 'test' folder and the 'test.php' (from the 'test_exported' folder) to the same directory as the form. It worked as expected, sending me an email with the form value pairs. You can see it at http://otsummerfest.org/artists/test_form1.html

I then changed the name of my form handler from 'test_handler.php' to 'test.php', as per your suggestion. Reloading the form in the browser produces unwanted results - instead of the form, I see the handler embedded, which has no values to display. http://otsummerfest.org/artists/test_form2.html

It seems I'm doing something wrong, but I can't figure out what. Thanks for any assistance you may be able to provide.
User 187934 Photo


Senior Advisor
20,271 posts

Looks to me that your form is named test1.php. You should be able to replace the test1.php that the form builder creates with your own test1.php that echo's the radio button values. Here's another form I did doing just that.
http://ericrohloff.com/coffeecup/ccforu … handeling/
I saved my form has customhandeling in the form builder. I then replaced the customhandeling.php with the my own with the code below.

Here's the only thing on the customhandeling.php
<?php
$cellnumber = $_POST['cellnumber'];
$name = $_POST['name'];

echo $name;
echo $cellnumber;
?>
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 2254047 Photo


Registered User
7 posts

Thanks - once I started replacing the right file, it started to work a little better.

My only troubles are:

- if I use the WFB-generated code on my page to display the form, the handler result displays in a subframe of the page. I also tried using an iframe to display the test/test.html file to display the form, but that also results in the handler displaying within the iframe (which is an html file, and so I can't further process the value pairs with PHP.)

- the only way to get the form to work properly was simply to use the test/test.html file as the main form, but it means I can "embed" it on a regular page in my site. I am going to try to spawn a new window to display the test/test.html file, to see if that's a possibility.

- the file handler works well, except it doesn't seem to be able to parse the results from a group of checkboxes...all I get is 'Array', without any values within the array. (This happens no matter whether I select none, one, or multiple options in the group.) The values for the text field and radio buttons do display properly. [And there is a name set for the checkbox group.]

I was hoping that this would provide a really fast way to create beautiful forms that I could easily process, but now I'm thinking that it may not work. I may be trying to make WFB do stuff it wasn't designed for...which is a pity, because I really like the interface!

Thanks again for all your help.
User 464893 Photo


Ambassador
1,611 posts

You will find that all your variables are posted, and if you redirect to a script you can access them. Obviously that is just the start from then you can do what you will with them.

Personally I like to grab the last entry in the created csv file and load the variables that way if I wish to do something out of the scope of WFB I can then reload a database, delete the stored file or email using php mail. It is possible also to write a Paypal script based on entries to send the client to Paypal for payment.

The Form Builder in its present form is a very adaptable program that guarantees faultless output. The best in its class IMO.

Having the entries in a MySQL database or csv file allows interrogation over time of the data
The Guy from OZ



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.