Jump to content
Server Maintenance This Week. ×

Trying to pass a parameter to a script from PHP application


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

Recommended Posts

Hello all

So I'm pretty new to Filemaker and CWP - I have created a form which people fill out and it stores the data in a filemaker solution. The idea being a script is then run which will notify a user if the form has been submitted.

Now I have the script for that and all the Filemaker side completed, as well as the data entry from the PHP form, but I am really struggling with running a script with a parameter...

It runs the script, but not the parameter attached.

For a bit of context, 

Someone fills out the form and it is entered into the database,

a script is then called with the parameter being an ID, the script then checks the ID with the parameter ID and then sends a notification to the user with the details from the record where the IDs match... but it will not pass the ID parameter into the script from the web application.


Here is my script

 

require_once ('FileMaker.php'); 
$fm = new FileMaker();

$fm->setProperty('database', 'comms__web');
$fm->setProperty('hostspec', 'http://192.168.X.XXX');
$fm->setProperty('username', 'web');
$fm->setProperty('password', 'XXXXXXXXXXXXXXXX'); 
    
$newPerformScript = $fm->newPerformScriptCommand('Web','TestScript','test');
$result = $newPerformScript->execute(); 

Please help me out here... Been trying to research this issue and nowhere really actually helps. 

 

Cheers

Jack

 

Edited by Jack Wright
Some mistakes
Link to comment
Share on other sites

if (FileMaker::isError($result)) { 

    echo "<p>Error: " . $result->getMessage() . "</p>"; 
    exit;

}

2. Insert  a Show Custom Dialog step at the beginning of the FM script to show get(ScriptParameter)   

 

Link to comment
Share on other sites

On 6/25/2016 at 3:46 AM, doughemi said:

if (FileMaker::isError($result)) { 

    echo "<p>Error: " . $result->getMessage() . "</p>"; 
    exit;

}

2. Insert  a Show Custom Dialog step at the beginning of the FM script to show get(ScriptParameter)   

 

WIll try this now, Thank You :)

I should also note, that when I try to set a variable for the parameter there is no parameter there.

Link to comment
Share on other sites

I've used CWP for a while now, and it's very rare that I find I need to use a FileMaker script to achieve what I want to... So, I've little insight on making it work as written.

But - why can't the form submit and insert to the database. The returned data also includes all the data from the layout where the input happened on the FileMaker side. Then use that data to phpMail the user with required details.

HTH

Link to comment
Share on other sites

I don't know what Show Custom Dialog will do for you. You're running the script via CWP. Show Custom Dialog isn't a supported script step.

1) Post your FileMaker script

2) How do you know the script is succeeding, just not the parameter?

3) If that's true, there may be a problem on the FM script side, not the PHP side.

 

Link to comment
Share on other sites

On 6/28/2016 at 6:12 AM, David Jondreau said:

I don't know what Show Custom Dialog will do for you. You're running the script via CWP. Show Custom Dialog isn't a supported script step.

1) Post your FileMaker script

2) How do you know the script is succeeding, just not the parameter?

3) If that's true, there may be a problem on the FM script side, not the PHP side.

 

1) - For this instance it is the test script: (view the image)

 

2) - In the test script I ask it to make a new layout then post the ID into that layout (The ID being the PHP_ID sent from the form itself) - The record is created, but no parameter, and you can see that I did an if statement to check whether there was a parameter, and when that was active no record was made, hence there wasn't a parameter, but without it a record is made so it is just the script that works. 
 

Screen Shot 2016-06-29 at 09.51.06.png

On 6/27/2016 at 11:22 PM, webko said:

I've used CWP for a while now, and it's very rare that I find I need to use a FileMaker script to achieve what I want to... So, I've little insight on making it work as written.

But - why can't the form submit and insert to the database. The returned data also includes all the data from the layout where the input happened on the FileMaker side. Then use that data to phpMail the user with required details.

HTH

For a bit of context...

The user fills a form and the data is sent directly to the database (That works fine) - The idea is to notify someone of when that message is sent, so I generate a random ID (I call the PHP_ID) this is then inserted into the database with the form and used as a parameter on the script, The script will then be written to check the parameter ID to the ID in the message, then send a notification to the user accordingly...

So if Someone was to fill the form out with the details


Dept: testDept
User: testUser
Message: testMessage

it would put those details (including an ID, date timestamp etc.) as well as the PHP_ID into a record on the database...

The script is then called which uses the SAME PHP_ID as the parameter. That script then looks through the database to find the record with the same PHP_ID, it will then send a notification to testUser on the filemaker database.... If I cannot pass this parameter I cannot do the check, thats where the issues lies.




 

Edited by Jack Wright
I was refering to layouts not records - may have been confusing
Link to comment
Share on other sites

This topic is 2855 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.