Jump to content

Can a New Record form pass info to an edit form on submit?


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

Recommended Posts

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.
Link to comment
Share on other sites

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');

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This is 2015, not 2005, did you consider using 2 way databinding for what you are doing? https://docs.angularjs.org/tutorial/step_04 ( would require some sort of REST API, like http://www.restfm.com )

Edited by ggt667
Link to comment
Share on other sites

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