Insert Record and pass url variables

Ask a Question related to Dreamweaver AppDev, Design and Development.

  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. Similar Questions and Discussions

    1. CF pass variables to Flash
      Hello: Basically I want Coldfusion to pass the server date to Flash. But I get '#theDt#' instead of the value of 'theDt' please see the code...
    2. Insert record
      Hi all, I'm having a bit of a problem at the moment. I'm basically trying to insert a record to a MS Access database. I'm using dreamweaver MX. What...
    3. How to insert a new record
      I am having problems with inserting a new record into access database using the detailsview control, the autonumber of the control does not update...
    4. Can one pass variables through a selector?
      In article <clund-50F2A4.12443709092003@amstwist00.chello.com>, C Lund wrote: Yes - either use an NSInvocation to perform the call, or call...
    5. how to pass in list and insert them one by one
      Hi, I have a parameter that pass in list to store procedure, for example, '21, 34, 254,3e3' how am I able to split it and insert one by one...
  3. #2

    Default Re: Insert Record and pass url variables

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

  4. #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

  5. #4

    Default Re: Insert Record and pass url variables

    On Wed, 30 Mar 2005 00:21:16 +0000 (UTC), brianevans5179
    <webforumsuser@macromedia.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

  6. #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

  7. #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

  8. #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

Posting Permissions

  • You may not post new threads
  • You may 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