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

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

Recommended Posts

Posted

Hi, I'm running FileMaker 12 on a Filemaker 13 server.  I'm able to sort and delete records, but cannot edit or create new records.  Here is a snippet of my code for entering a new record, any help would be appreciated!

<?php include('start.php');?>

<?php

$request = $fm->newAddCommand('my_layout');
$request->setField('FirstName', $_POST['FirstName']);
$result=$request->execute();

?>

<form action="InsertRecordSimple.php" method="post" name="Insert">
<table border="1">
  <tr>
    <td>First Name </td>
    <td><input name="FirstName" type="text" id="FirstName" /></td>
 
 
  </tr>
</table>
<p>
<input name="insert" type="submit" id="save" value="Save" input />
<input name="insert" type="submit" id="cancel" value="Cancel" input />
</form>

 

Posted

First, make sure that you are using the FM 13 API files.  I had problems when I used FM12 API when I upgraded to FMS13.

Add 

ini_set('display_errors', '1');

 to the beginning of your php code to help troubleshooting (comment it out for production).

Your php should check for  whether the form has been submitted before doing anything with $_POST data:

if(isset($_POST['insert'])){
	$request = $fm->newAddCommand('my_layout');
	$request->setField('FirstName', $_POST['FirstName']);
	$result=$request->execute();
	if(FileMaker::isError($result)){
		echo $result->getMessage();
	}
}

Otherwise, you will get an invalid index error. (the ini_set statement above will display that for you). The last if() allow you to see what errors the API is reporting.

If these do not help you pinpoint the error, post your findings.

Posted

No way to tell, that I know of, but I haven't dug into the files themselves.

They're located in <yourVolume>/Library/Filemaker Server/Web Publishing.  I just went ahead and replaced the ones in my directory with these.

Posted

Thanks doughemi, it's crazy, I can sort and delete records but can't edit or create new ones.  Plus deleting doesn't ask for a password as it should with my security protocol.  Where did you get the proper  FMS 13 API files?

Posted

They're installed in the folder I mentioned when FMS is installed, in a zip named "FM_API_for_PHP_Standalone"

Posted

Thanks again for your help.  My database is being hosted by FMPHosting server, so I don't know where /Library/Filemaker Server/Web Publishing is or how FM_API_for_PHP_Standalone works.  I'm a novice and am reading 2 books on FileMaker and PHP.   Everything works except editing and creating new records.  Thanks for you previous code examples, but my results didn't change.

Posted

Contact the hosting service to see if they will send you a copy of the API.

What error messages were shown after you added the error trapping code?

Does the privilege set for the php username allow record creation?

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