Professional Web Applications Themes

Insert Record and pass url variables - Dreamweaver AppDev

Using PHP and MySQL, I want to set up a form that inserts a new record into the database, and on the redirect page, i want it to have a url variable with the "id" of the record so it can pull up that information on the second page - like a confirmation page. Any ideas?...

  1. #1

    Default Insert Record and pass url variables

    Using PHP and MySQL, I want to set up a form that inserts a new record into the
    database, and on the redirect page, i want it to have a url variable with the
    "id" of the record so it can pull up that information on the second page - like
    a confirmation page.

    Any ideas?

    brianevans5179 Guest

  2. #2

    Default Re: Insert Record and pass url variables

    How about an 'Insert Record and Set Cookie" - how would i do that?
    brianevans5179 Guest

  3. #3

    Default Re: Insert Record and pass url variables

    don't know about php i know asp but this may help"
    look for this:
    ' *** Insert Record: set variables

    If (CStr(Request("MM_insert")) = "form1") Then

    And insert this:
    Session("AnySessionName") = Request("NameOfHiddenFieldWithTheIdBoundToIt")

    so it looks like this:
    ' *** Insert Record: set variables

    If (CStr(Request("MM_insert")) = "form1") Then
    Session("AnySessionName") = Request("NameOfHiddenFieldWithTheIdBoundToIt")

    this will create a session named "AnySessionName" with the value of the
    hidden field, upon record insert
    you can retrieve that session on another page.
    or go to
    Bindings > + > session variable


    Jeremy Guest

  4. #4

    Default Re: Insert Record and pass url variables

    On Wed, 30 Mar 2005 00:21:16 +0000 (UTC), brianevans5179
    <webforumsusermacromedia.com> wrote:
    > Using PHP and MySQL, I want to set up a form that inserts a new record
    > into the
    > database, and on the redirect page, i want it to have a url variable
    > with the
    > "id" of the record so it can pull up that information on the second page
    > - like
    > a confirmation page.
    >
    > Any ideas?
    >
    You can use ImpAKT which is an extension we made to do this processes
    almost automatically. Check the flash demo's to see the speedness of it:
    [url]http://www.interaktonline.com/Products/Dreamweaver-Extensions/ImpAKT/Overview/[/url]


    --
    Alexandro Colorado
    ------------------------------
    Support Engineer
    InterAKT Online
    [url]http://www.interaktonline.com[/url]
    Tel: 40(21) 312.5312
    Alexandro Colorado Guest

  5. #5

    Default Re: Insert Record and pass url variables

    brianevans5179 wrote:
    > Using PHP and MySQL, I want to set up a form that inserts a new record into the
    > database, and on the redirect page, i want it to have a url variable with the
    > "id" of the record so it can pull up that information on the second page - like
    > a confirmation page.
    It's very simple, but requires a little digging in Code view. Locate the
    SQL statement that inserts your data into the database. It will begin with:

    $insertSQL = sprintf("INSERT INTO

    A few lines further down, you will see something like this (the names of
    the variables are likely to be different, but the pattern will be the same):

    $Result1 = mysql_query($insertSQL, $myConn) or die(mysql_error());

    $insertGoTo = "mynewpage.php";

    Change those lines like this:

    $Result1 = mysql_query($insertSQL, $myConn) or die(mysql_error());
    $theID = mysql_insert_id();

    $insertGoTo = "mynewpage.php?id={$theID}";

    This will send the ID as a query string to mynewpage.php. You can then
    use the ID to create a Recordset containing the details of the record
    you have just inserted. Set Filter in the Recordset dialog box to the
    name of your primary key, select = URL Parameter and type "id" into the
    box next to URL Parameter.

    --
    David Powers
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    Co-author "PHP Web Development with DW MX 2004" (Apress)
    [url]http://computerbookshelf.com[/url]
    David Powers Guest

  6. #6

    Default Re: Insert Record and pass url variables

    Thanks David. That was just want I was looking for. Your The Man! Works
    Great!

    Originally posted by: Newsgroup User
    brianevans5179 wrote:
    > Using PHP and MySQL, I want to set up a form that inserts a new record into
    the
    > database, and on the redirect page, i want it to have a url variable with
    the
    > "id" of the record so it can pull up that information on the second page -
    like
    > a confirmation page.
    It's very simple, but requires a little digging in Code view. Locate the
    SQL statement that inserts your data into the database. It will begin with:

    $insertSQL = sprintf("INSERT INTO

    A few lines further down, you will see something like this (the names of
    the variables are likely to be different, but the pattern will be the same):

    $Result1 = mysql_query($insertSQL, $myConn) or die(mysql_error());

    $insertGoTo = "mynewpage.php";

    Change those lines like this:

    $Result1 = mysql_query($insertSQL, $myConn) or die(mysql_error());
    $theID = mysql_insert_id();

    $insertGoTo = "mynewpage.php?id={$theID}";

    This will send the ID as a query string to mynewpage.php. You can then
    use the ID to create a Recordset containing the details of the record
    you have just inserted. Set Filter in the Recordset dialog box to the
    name of your primary key, select = URL Parameter and type "id" into the
    box next to URL Parameter.

    --
    David Powers
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    Co-author "PHP Web Development with DW MX 2004" (Apress)
    [url]http://computerbookshelf.com[/url]




    brianevans5179 Guest

  7. #7

    Default Re: Insert Record and pass url variables

    brianevans5179 wrote:
    > Thanks David. That was just want I was looking for. Your The Man! Works
    > Great!
    Glad to have been of help, Brian.

    --
    David Powers
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    Co-author "PHP Web Development with DW MX 2004" (Apress)
    [url]http://computerbookshelf.com[/url]
    David Powers Guest

Similar Threads

  1. CF pass variables to Flash
    By lvbao in forum Coldfusion Flash Integration
    Replies: 4
    Last Post: May 8th, 10:26 PM
  2. Insert record
    By t.d. in forum Coldfusion - Getting Started
    Replies: 14
    Last Post: July 25th, 02:25 PM
  3. How to insert a new record
    By European in forum ASP.NET Building Controls
    Replies: 0
    Last Post: December 1st, 03:39 AM
  4. Can one pass variables through a selector?
    By Andrew Hunter in forum Mac Programming
    Replies: 5
    Last Post: September 10th, 03:18 PM
  5. how to pass in list and insert them one by one
    By Mike in forum Microsoft SQL / MS SQL Server
    Replies: 3
    Last Post: July 9th, 12:01 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139