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 a New Record form pass info to an edit form on submit?

Featured Replies

Hi, I'd like my New Record.php  to advance to an Edit.php upon clicking submit on the New Record form.  I don't want to remain on the New Record.php, but doing otherwise gives me a 'no record created' message.  Here's an example of my New Record.php

Thanks!

newinputplayer.php

Change line 123 to:

$rec_id = $result->getLastRecord()->getRecordID();
header("Location: edit.php?id=".$rec_id."&message=Record was created successfully.");
die();

In your edit.php use the passed $_GET['id'] and $_GET['message'] to populate your form properly.

I hope this helps.

Also, change the first few lines - the redirect will fail as it is currently formatted - the gap between the two php snippets will cause the web server to claim data has already been sent:

 

<?php require('start.php');

$layout =& $fm->getLayout('mylayout');
$values = $layout->getValueList('programlist');

 

  • Author

Thanks dwdata and web, that worked great!  I tried the same process to redirect from an edit page  to another page, but it didn't work.  here is some code and the entire page.  Is my redirect wrong?  Thanks!

if (FileMaker::isError($result)) 
            {
            $message = "<p>Error: " . $result->getMessage() . "</p>";
            exit;
            }
        else
            {
                $rec_id = $result->getRecordID();
header("Location: playeredit.php?id=" . $rec_id . "&message=SSV First Test Successful");
die();
    }

 

 

 

 

 

 

 

 

ratingtest1.php

Line 36 can be changed to:

$rec_id = $_POST['id'];

Hope this helps!

  • Author

hi dwdata, I tried your second code with $rec_id = $_POST['id']; and it bypassed the target page and redirected back to my original 'player edit' page with the 'success' message.  here is my player edit page with a form button to my ratingtest1 page on line 446.  here is a link to my player edit page, click test 1.  thanks!

http://ssvtennis.com/playeredit.php?id=15610

 

ratingtest1.php

playeredit.php

Looks like you need to shift your RESULT code check into the $_POST IF statement. Check out the mod I did.

 

ratingtest1-2.php

Edited by dwdata

  • Author

Thanks dwdata, that was brilliant.  you made my day!

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.