Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Can someone please tell me a way of creating...

Featured Replies

I need a solution, workaround, anything to get this to work. I need to add mutliple records to a database based on the amount of records in another database. Then I need to edit those records. I have looked into everything there is. Php I thought would work but it says in the FX.php class that you can have only one query string on a page so that would eliminate that. I have tried portals and the .0 without success. Is there any way of doing this?

Justin Grewe

"Portals" is a good method.

I have also used PHP (not FX.php) and the "file_get_contents()" function. Examples of this exist on the Forum (however they maybe too long ago).

Good Luck.

Garry

  • Author

How come this will not work Garry?

<form action="FMPro" >

<input type="hidden" name="-db" value="Evalrespond1.fp5" />

<input type="hidden" name="-lay" value="AdminRespond" />

<input type="hidden" name="-format" value="-fmp_xml" />

<input type="hidden" name="-styletype" value="text/xsl"/>

<input type="hidden" name="-stylehref" value="findquestions.xsl"/>

[FMP-Record]

<input type="hidden" name="Evalrespond1::QuestionID.0" value="[FMP-Field: QuestionID]"/>

<input type="hidden" name="Evalrespond1::RegistrationID.0" value="[FMP-CurrentToken:0]" />

[FMP-Record]

<input type="hidden" name="-recid" value="44702"/>

<input type="submit" name="-edit" value="Submit" />

</form>

Where for every record in one database it creates a new portal row in the other. Otherwise can you be more specific on how to do this with portals?

Thanks,

Justin Grewe

"Evalrespond1::RegistrationID.0" creates a new related record (one only). To edit existing Portal Rows you could use this:

<input type="hidden" name="Evalrespond1::QuestionID.[FMP-CurrentRecordNumber]" value="[FMP-Field: QuestionID]"/>

<input type="hidden" name="Evalrespond1::RegistrationID.[FMP-CurrentRecordNumber]" value="[FMP-CurrentToken:0]" />

This line:

<input type="hidden" name="-db" value="Evalrespond1.fp5" />

would need to reference the Master DB, not the Related DB.

I would need to look at the whole application to advise accurately on the best solution.

All the best.

Garry

Actually, with FX you can make as many DB calls in a single PHP script as you like. Here is a particularly useful example, which allows you to create X number of entries in the database to match X number of provided input from an HTML form:


<body>

<?

if ($_REQUEST['mySubmit']) {

	[color:"green"]// User clicked the mySubmit button[/color]

	

	require("../fx/FX.php");

	foreach ($_REQUEST["userName"] as $userName) {

		[color:"green"]// Create a new record for each userName[] input

		// that is not empty

		//[/color]

		$q = new FX ("127.0.0.1", "591");

		$q -> SetDBData ("userName.fp5", "web");

		$q -> AddDBParam ("name", $userName);

		$q -> FMNew();

		

		print ("Record inserted: ".$userName."<br>n");

	}

}

?>

<form name="myForm" action="<?=$PHP_SELF?>" method="post">

	<input type="text" name="userName[]" value=""><br>

	<input type="text" name="userName[]" value=""><br>

	<input type="text" name="userName[]" value=""><br>

	<input type="text" name="userName[]" value=""><br>

	<input type="submit" name="mySubmit">

</form>

</body>

Perhaps you misunderstood what you read? You can only submit one URL to a PHP script, but that one PHP script can in turn send unlimited URLs to another program (such as FileMaker).

Further, PHP makes it very easy to read in a list of submitted Form Inputs, work with them as an array, and if you want take an action for each Form Input. This is one of the many strengths of PHP. =)

Please read my previous post first...

It is also easy to find records in one table and create child records for them in another table. Here is an example that finds all the records in the "parent.fp5" table and create one related child for each parent:

<?

require("../fx/FX.php");

 

[color:"green"]// Find all records in parent table[/color]

$q_parent = new FX("127.0.0.1", "591");

$q_parent -> SetDBData("parent.fp5", "web");

$r_parent -> FMFindAll();

 

[color:"green"]// For each parent, create one related child[/color]

foreach ($_parent['data'] as $parent_row) {

	$q_child = new FX("127.0.0.1", "591");

	$q_child -> SetDBData("child.fp5", "web");

	$q_child -> AddDBParam("key_parentID", $parent_row['key_primary'][0];

	$q_child -> FMNew();

	print ("Child created for parent ".$parent_row['key_primary'][0].".<br>n";

}

?>



Sorry, one last thing:

Notice that with PHP, if you append brackets "[ ]" to your HTML input names, then those input are received by the PHP script as an array.

  • Author

Thanks Mariano!

This looks like it will work. I guess I did read the readme file of FX.php wrong and maybe a little of not understanding the whole process of the query string and forms. Thanks again.

Justin Grewe

Hey no problem! We're all learning here smile.gif

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.