close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Update after Insert

Thread began 10/28/2011 10:30 am by anthony399409 | Last modified 11/01/2011 12:41 pm by anthony399409 | 4043 views | 10 replies

Jason ByrnesWebAssist

If you look at the code for an insert, you will see that the redirect URL is created before the record has been inserted. It cant use the ID of the record that will be inserted in the redirect, because that value cannot be know yet, it can only be known after the record inserts.

If you look further down the code, you will see this line after the code to perform the insert:

php:
$_SESSION[$WA_sessionName] = mysql_insert_id();



This code stores the inserted records ID into a session variable.

further up the code, you will see a line that sets the $WA_sessionName variable, it will look something like:

php:
$WA_sessionName = "WADA_Insert_visitors";



this sets the name that will be used for the session:

php:
$_SESSION['WADA_Insert_visitors']



if you want to go directly to the update page from the insert, you will need to leave the redirect in the insert behavior blank, then add code after the insert to perform the redirect using the newly created session variable in the URL.

Add this code just after the insert record behavior.

php:
<?php 
if($_SERVER['REQUEST_METHOD'] == "POST") {
    
header("Location: ads_Update.php?id_ad=".$_SESSION[$WA_sessionName]);
}
?>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...