October 12, 201510 yr 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
October 12, 201510 yr 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.
October 12, 201510 yr 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');
October 14, 201510 yr 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
October 14, 201510 yr 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
October 15, 201510 yr 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 October 15, 201510 yr by dwdata
October 16, 201510 yr 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 October 16, 201510 yr by ggt667
Create an account or sign in to comment