Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2003 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi,

Need some help, I built a CWP year ago but the solution never came about.  I am in search of a tutorial that can give me some very basic examples but unable to locate any at this time.

I will be meeting with the server hosting the soluiton Friday and I would like to have the HTML written and ready to upload to the server where the file for the solution is for CWP.

All I am doing is providing a html page so any persan can navigate too, enter in the 8 pieces of infomation on the html page ...

Project Name:

Description:

Qty:

Size:

Stock:

Printing:

Finishing:

Shipping:

Error check those html field to make sure there is data, then post those field to a predetermined table on filemaker specificlly for those eight fields, then send a response back -

"Thank you we'll be in touch."

The current FileMaker PHP tutorials are too complicated. And I am not able to get any personnal assistance until next week, eariliest.

Is there anybody in the forum that would have some basic example ( HTML / PHP ) written to accomplish this.  If I remember correctly, the html / php was one file.  Maybe I'm wrong.  

I am going to establish a Privilege Set / LogIn / Password / Table with eight fields specifically for this html form.

Until I can find an actual tutorial that will help, I am asking if there is anybody here that would have any example I can follow.

I would be grateful, thank you.

Mr. Ignoramus

Posted

You write CWP; Do you use FX.php?

Posted (edited)

Hi,

No.

All is did was write basic html with php together on the same page html page from a text editor and placed on the server in a certain folder.  This was a while back.

It wasn't very complicated but I just can not remember all the details ... frustating.

Thank you.

 

I know I had to log in the user to the database which was done in the back ( hidden ) when I posted the form ... but I need to piece all the pieces back togther again.

Any examples that would include retreving the base html ( form data ) then posting ( logging In -> create record -> enter data into field -> sending back a "Thank you will get in touch" ) I would be grateful.

Thank you.

Edited by "... you mean these fans?"
Posted (edited)

Here are the cURL command lines that I use the most; just translate these to php or any other language using cURL and you should be all set( omit the s, k, and L options for production use. ) :

1) Will list the available database.

curl -s -u username:password -XPOST -kL "http://localhost:8080/fmi/xml/FMPXMLRESULT.xml?-dbnames"

2) Will add a new record with specified parameters.

curl -s -u username:password -XPOST -kL "http://localhost:80/fmi/xml/FMPXMLRESULT.xml?-db=databasename&-lay=layoutName&-new&field1=contentOfField1&field2=contentOfField2" | tidy -i -xml -wrap 0

3) Will select a random record from the given database & table.

curl -s -u username:password -XPOST -kL "http://localhost:80/fmi/xml/FMPXMLRESULT.xml?-db=databasename&-lay=layoutName&-findany" | tidy -i -xml -wrap 0

But if you would like simple, perhaps FX.php or phpFileMaker would do you good.

Edited by ggt667
Posted (edited)

Not what I am asking for 😞

1 - Not required - available databases - Already know database name

3 - Not required - just want to post data to database ... then send back "Thank you will be in touch."

Again, this is too complicated ... need step by step.  I've done it, frustrating I can not remember the process.

Still looking for an practical tutorial that explains how to connect to a FileMaker database from a html page, post the data on the html page and return a text string "Thank you will be in touch".

Any assistance here I will be grateful.

Thank you.

Mr. Ignoramus

Edited by "... you mean these fans?"
Posted (edited)

Sounds like you are looking for one of the examples in the FX.php package: http://fx.iviking.org/

Edited by ggt667
Posted

I do something similar to receive SMS messages from our SMS provider. Customer can send text messages, which our SMS provider forwards to our FM server. It's basically a post to our server that is processed using PHP.

<?php

require_once ('FileMaker.php');

#Some sanitization, I know what sort of data I can expect in the various variables.
$SMS_to      = isset( $_GET['to'] ) ? preg_replace('/[^0-9]/', '', $_GET['to'] ) : "";
$SMS_from    = isset( $_GET['from'] ) ? preg_replace('/[^0-9]/', '', $_GET['from'] ) : "";
$SMS_message = isset( $_GET['message'] ) ? preg_replace('/[^a-zA-Z0-9%]/', '', $_GET['message'] ) : "";
$SMS_ref     = isset( $_GET['ref'] ) ? preg_replace('/[^0-9]/', '', $_GET['ref'] ) : "";

$fm = new FileMaker(); 
$fm->setProperty('database', 'Database Name'); 
$fm->setProperty('hostspec', 'http://localhost'); 
$fm->setProperty('username', 'username'); 
$fm->setProperty('password', 'password'); 

#I built a new parameter line from the provided variables to use when calling my FM log script. Every attempt is logged.
$param = '';
foreach( $_GET as $key => $value) {
         if( $param === "" ) {
             $param = $param . $key . "=" . $value;
             } else {
             $param = $param . "&" . $key . "=" . $value;
             }
         }
$log = $fm->newPerformScriptCommand('SMSLog', 'SMSBroadcast_Log', $param); 
$result = $log->execute();

#This is where the real work happens. Checking if all required variables are populated, then invoke the FM script that handles inbound SMS.
if( $SMS_to === "" or $SMS_from === ""  or $SMS_message === "" ) {
    if( $SMS_to === "" ) echo 'missing to<br>';
    if( $SMS_from === "" ) echo 'missing from<br>';
    if( $SMS_message === "" ) echo 'missing message<br>';
  } else {
    $newPerformScript = $fm->newPerformScriptCommand('MSG_Base', 'SMSBroadcast_InboundSMS', $param); 
    $result = $newPerformScript->execute();
    echo 'OK';
  }

?>

All this script does is relay the SMS our SMS provider sends us on to FileMaker. FileMaker then parses the variables and actions however necessary.

Maybe that helps?

Posted (edited)

Here is more of a "See Spot run" example. You only have to fill in the specifics of your file system and add the rest of the inputs.

HTH

IMPORTANT-- make sure that the "Access via PHP Web Publishing" extended privilege is turned on in the privilege set of the user you have set in the php file.

 

mrIgnoramus.php

Edited by doughemi
repaired file attachment
Posted (edited)

doughemi,

Thank you for the file ... I just returned with what I've done and noticed your file. I will have to study it.

I've attached what I've done and I can not get past the $fm variable error.  For some reason I can not log into the database.

I've removed sensitive log in data but I have tried both the numeric value for the host and the host name; meaning 

hostname.com and 121.34.43.0 

I also tried entering the file name; menaing 

FileName and FileName.fmp12

I also tried entering both the include and the require_once

I keep erroring on line 13/14

I've checked the server to make sure php is on and that the user has been assigned the privilege set for the php ?

I'm planning on speaking to the server in the morning to see if there are any privileges not set on the server end ... can any one look at the code I've written and see if I'm doing anything wrong.

I would be grateful.

Thank you.

c_newrecordtst.php

 

 

Edited by "... you mean these fans?"
Posted

Here is the error that is returned.

I've included some other stuff.

Thank you.

mrignoramus_01.pdf

I am going to assume that "pm" means permissions ?

I've got a call into the server to check on them.

But on my side, I've create the account for the php and I've assignd the php access in the privilege set.

So I don't know what else I can check.

Thank you.

Posted (edited)

So  I navigated over to Soliant and they had a little php to test the connection ... I ran it and adjusted the parameters so that I got the "connected" echo.

1447925076_ScreenShot2019-05-20at1_54_53PM.thumb.png.22cdcb0c186dfc27dc398ea33cda9aea.png

So I went in an replaced my entries in my php and I still error.  I've reattached the form ( index.html ) the create new record ( c_newrecord.php ) and the thankyou.php.

The url: https://31.datatrium.com/5072/index.html

Any assistance here I would be grateful.  I am only pushing in one field from the form at this time.  will do the rest later when things work.  When I click on the submit button the form action is calling the c_newrecord.php script.  This is right from the tutorials I'm referencing.  I just don't understand what I'm doing wrong.

Thank you.

index.html

c_newrecord.php

thankyou.php

 

Here is the test_connection.php file;

test_connection.php

Edited by "... you mean these fans?"
Posted

Attached is a modified copy of c_newrecord.php which works with your database. You will have to change the name back to c_newrecord.php. The file will echo a list of the Company Name fields in the database each time you run it. The code which does this is marked with comments so you can remove it. 

You may want to delete your pdf in your earlier post-- TMI on a public forum. I removed the login info from the file, but I made no changes in what you provided. You do not need the .fmp12 extension on the filename.

If FileMaker.php is in the same directory as c_newrecord.php, then the relative path is simply FileMaker.php in the include statement.

c_newrecord_dh.php

Posted

doughemi,

The record created ... thank you.

I get this error though ...

PHP Notice:  Undefined variable: list in C:\Program Files\FileMaker\FileMaker Server\HTTPServer\conf\5072\c_newrecord.php on line 57

As long as the record is being created I'm good to go.  Yes I would like to error out if the record does not create so the customer can see that there was an issue, with some instruction what to do, but I will take this for now.  Fantastic.  Thank you.

***I did not want to forward the files but I had no choice, the tutorials (many) were useless other than Soliant's php db connection test and I am unable to communitcate to this forum in a manner that you guys require.  I can only say, I am sorry.

And, I still have no idea what went wrong.  I will take time now and study your file; run many test ...  Again thank you.

I'm going to comment out this error and put pack the thankyou.php.  This was an exhausting ... 5 days.

 

To whom it may concern,

doughemi suggest that I remove the pdf / files I had to post to resolve this issues, but I have no way of doing this ??  The edit button is not available to me anymore.

If anybody has any suggesiton how to do this I would be grateful.

Thank you.

 

Posted

I didn't initialize the variable before I used it.

Add this line:

$list = '';

before

                 foreach($showRec as $record){
                    $data = $record->getField('WBForm_Company_Name');
                    $list = $list . '<br>' . $data;
                  }

(lines 55-58)

This topic is 2003 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.