Professional Web Applications Themes

How do I use URL parameters to return a specific field? - Dreamweaver AppDev

I have a form, when users complete it I would like to have a confirmation page that returns the value of the "first_name" field from the form, eg. "Hi John, thanks for your application". I'm at my wits end getting this to work. I have gone through several drmwvr and php related books and I'm still stuck. The only record that returns is the first one listed in the database. If the next form user will be #35 in the db and named "Mary", how do I get "Mary" to show up on the confirm page. My db (mysql) consists ...

  1. #1

    Default How do I use URL parameters to return a specific field?

    I have a form, when users complete it I would like to have a confirmation page
    that returns the value of the "first_name" field from the form, eg. "Hi John,
    thanks for your application". I'm at my wits end getting this to work. I have
    gone through several drmwvr and php related books and I'm still stuck. The
    only record that returns is the first one listed in the database. If the next
    form user will be #35 in the db and named "Mary", how do I get "Mary" to show
    up on the confirm page.

    My db (mysql) consists of the following fields:
    ProdID
    CustID
    FirstName
    LastName
    Phone
    Email
    Website

    My confirmation page has:
    FirstName

    I have the form properties set as: Method=POST, Action=confirm.php.

    In the 'Filter' section of the Recordset dialog box, I have the following
    settings:
    CustID = URL Parameters FirstName. Same values for the confirm page. What am I
    doing wrong?

    blu_sky Guest

  2. #2

    Default Re: How do I use URL parameters to return a specificfield?

    well, while I am at a loss to tell you much about php, you have a lot of fields
    to carry on the URL. It is common to carry one or two fields in your URL, but
    there is a size limit on the URL length, so it is more accepted to pass these
    in the header section of the HTML rather than on the URL. In Javascript or C#,
    you could do this Session['prodid']=Request['txtProdID'] / ... thru /
    Session['website']=Request['txtwebsite'] that would put this information into
    variables that would persist beyond the next page. Then you could use PHP to
    output the string of either your request variable on the next page, or your
    session variable anytime after the point when you save it in the session. PHP
    is older, so you may persist those values in a temporary file or someting and
    put the fileid on the URL of every page you hand back to the web user. Then
    you have a session cookie and you can look up the data corresponding to your
    previous conversations with that webuser. Sorry.. not a PHP fool.. but I bet
    the Behaviors panel will write some of this sort of stuff for you, and the help
    files will show the rest. Rm

    RichMcCrea Guest

  3. #3

    Default Re: How do I use URL parameters to return a specific field?

    If the form is using the POST method then you could use:

    $_POST['FirstName']

    So something like Hi <?php echo $_POST['FirstName']; ?>, thanks for your
    application

    will work
    As far as I can see you dont need to call athe Db for this?
    HTH

    A
    "blu_sky" <webforumsusermacromedia.com> wrote in message
    news:cvolab$ep2$1forums.macromedia.com...
    >I have a form, when users complete it I would like to have a confirmation
    >page
    > that returns the value of the "first_name" field from the form, eg. "Hi
    > John,
    > thanks for your application". I'm at my wits end getting this to work. I
    > have
    > gone through several drmwvr and php related books and I'm still stuck.
    > The
    > only record that returns is the first one listed in the database. If the
    > next
    > form user will be #35 in the db and named "Mary", how do I get "Mary" to
    > show
    > up on the confirm page.
    >
    > My db (mysql) consists of the following fields:
    > ProdID
    > CustID
    > FirstName
    > LastName
    > Phone
    > Email
    > Website
    >
    > My confirmation page has:
    > FirstName
    >
    > I have the form properties set as: Method=POST, Action=confirm.php.
    >
    > In the 'Filter' section of the Recordset dialog box, I have the following
    > settings:
    > CustID = URL Parameters FirstName. Same values for the confirm page. What
    > am I
    > doing wrong?
    >

    Duncan Ellwood Guest

  4. #4

    Default Re: How do I use URL parameters to return a specificfield?

    I have tried using <?php echo $_POST[FirstName];?> in the past, and it returns
    the field to the confirmation page just fine. However, it totally bypasses the
    db, and so the form data is not inserted into the db. I need to have both
    events occur on submit - form data goes to db and confirmation page, preferably
    personalized with the "FirstName" field.

    I sense that the solution is something very simple, but with just a few days
    of mysql_php under my belt, I am stumped. Any more ideas?

    blu_sky Guest

  5. #5

    Default Re: How do I use URL parameters to return a specificfield?

    I don't do php yet, filtering your recordset by a URL parameter on the form
    page will be problematic, as there most likely isn't going to be a variable
    passed by the page before the form page to take advantage of the filter. And on
    the confirm page, filtering your recordset by a URL parameter probably isn't
    going to help either. Instead, you can pass a URL variable with the first name
    from the form upon submit and your confirm page can retrieve this URL parameter
    to make up the confirmation message for the submitter. I'm assuming you are
    using the DW built-in behaviors to set up an INSERT RECORD on the form page. If
    so, go into the settings interface on your form page for 'Insert Record' and
    there should be a field that indicates where the page redirects to upon Submit.
    Click the browse button next to this field to search for your redirect file,
    but before selecting it, click the Parameters button, name your variable
    something like 'firstname' and in the value field, click the lightening bolt
    icon, then expand your form elements and select the first name field. Click OK
    twice. Select your confirm page file name. Click OK. This will make it so that
    upon submit you are taken to the confirm page but you'll notice the URL in the
    browser window will say something like
    [url]http://www.blahblah.com/redirect.php?firstname=Ralph[/url] Now - you still need to
    do something with this. On the thank you page you can either retrieve the
    passed URL variable, or if you really want to use the database, you can always
    retrieve only the most recent submittal, which should be this new submitters
    data. HTH Bill

    Billium99 Guest

  6. #6

    Default Re: How do I use URL parameters to return a specificfield?

    Thanks for the info Bill, I'm almost there! Per your instructions, I got the
    "FirstName" field to merge flawlessly into the confirmation page. However, the
    data is not being inserted into the db whenever it passes to the confirm page.
    It has come down to an either \ or proposition - either the data is inserted
    into the confirm page, or to the db - i can't seem to get it to do both.

    In the form's 'Action' properties, the following string inserts quite well to
    the db: <?php echo $editFormAction;?>.

    This one inserts form data to the the confirm page without any problems:
    confirm_entry.php?FirstName=<?php echo $row_rsMerchants['FirstName']; ?> .

    As I am new to php, I am having a difficult time finding the right syntax for
    joining both strings - which, I think, is what I need to do to get it to work
    as I need it to. I feel really close to solving this puzzle, but I still need
    just a bit more input.

    blu_sky Guest

  7. #7

    Default Re: How do I use URL parameters to return a specificfield?

    I think we're stuck unless we can get some expert input here, as I can't really
    help with php syntax either. My only suggestion would be to switch the order of
    the two pieces of code in case the second piece currently needs something to
    execute that it's not getting because of the first piece executing. Sorry I
    can't be more of a help Bill

    Billium99 Guest

Similar Threads

  1. Webpage that will return a specific status code?
    By DaveWeil in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: February 1st, 07:04 PM
  2. output parameters not working in if return resultset
    By Charts in forum ASP.NET Data Grid Control
    Replies: 3
    Last Post: November 4th, 12:59 AM
  3. WS parameters & return values data integrity
    By Strider in forum ASP.NET Web Services
    Replies: 0
    Last Post: April 26th, 10:01 AM
  4. LoadVars in fuction - return parameters
    By alien251 webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: January 31st, 03:32 PM
  5. Carriage Return in WebMethod parameters
    By Alin Popovici in forum ASP.NET Web Services
    Replies: 1
    Last Post: January 9th, 10:18 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