Jump to content

Q:Display latest record in preview after inserting


Recommended Posts

I have two pages: insert and review. "insert" is to add new record to db, and "review" is to display the single record just added to db. The Recordset in "review" page is set to have "id" = colname with default value is 1. In Insert Record behavior on "insert" page, I set go to "review.php" after inserting.

 

Code for this part is below:

 

$insertGoTo = "review.php";

if (isset($_SERVER['QUERY_STRING'])) {

$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

$insertGoTo .= $_SERVER['QUERY_STRING'];

}

header(sprintf("Location: %s", $insertGoTo));

 

Although it goes "review" page but only display 1st record. But if I add "?id=5" (assume 5 is the lastest id in recordset) after review.php, it works, which display the single latest record.

 

But I can not add "?id=id" to $insertGoTo = "review.php"; , cause it becomes a string then.

 

How can I pass the id value to $insertGoTo ?

 

appreciate any help!

 

 

Tony

Link to comment
Share on other sites

I don't know if this is what you want, but I suggest changing your approach. I don't see why you want to send the user to another page after they have updated a record. Instead how about if the record which is being updating shows the current data from each field as the default value. When you submit to update the record now the new data will be displayed. This way if a change has to be made it can be done quickly since you're already at the update screen.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.