Ok, quick question that I hope will be easy to answer. I'm using Dreamweaver CS4 and I've built an update form that, upon submission, I'd like to pass an ID on to the next page. I've inserted the update form behavior, pointed to the right page in the "on submit" topic, and identified and named the id in "Parameters. When I run the update form, it directs to the right page, but in the url the value that's being passed is "ID=&". Obviously, the appropriate information is not being loaded on the next page. The only reason I can think that this would be happening is that the ID in question is generated dynamically in the field on the update form. In other words, its not a static value. Does anyone have a solution to this problem? I'd greatly appreciate it.
Thanks!
-CB
Make sure that you have read the following
Announcement: How Important is Code? A plea for new posters to help us!
Please don't ask a layout question (or really almost any other question) here without also giving us a look at the code on your page.
The best way to do this is to upload the page and its dependent files, and to post a link to this uploaded page. A poor second alternative would be to paste your code into your post using the double chevron icon on the toolbar, and selecting Syntax Highlighting > Plain Text.
Without knowing what you have in your code, we cannot possibly answer anything other than a very simple question. Save us the trouble of engaging in twenty questions to find out what you have done and just show us the code. After all, it's what determines what happens on the page, not your screenshot or your description.
Please?
Also, if your question is one that involves database use or server-scripting, please tell us what server model (PHP, CF, etc.) and database you are using (MySQL, SQL Server, etc.), as well as the operating system and platform. All of those details are necessary for complete troubleshooting and will help us help you through the process!
by Murray *ACP* (04-Aug-2010)
Gramps
very sorry. I can do that. First, I'm using PHP and MySql. Here's the link:
http://www.iotheatre.com/character/castsupport.php
I'm trying to get Character_ID to pass to the next page. It passes with "Character_ID=&"
Thanks for the help!
-CB
You ARE passing Character_ID with a value of 14 to the next page. But you are using the POST method, so you will not see this in the querystring. In your /castsupport.php page, you need to retrieve variables sent via POST, not GET. Or, change the method in the form to GET.
Thanks for the replies so far. Bregent has the right area of concern. I've tried retrieving that variable using the POST method; for example, I've tested it by creating a recordset using "$_POST['Character_ID']" as a variable, or even doing something as simple as "<?php echo $_POST['Character_ID']; ?>" but it never retrieves. What am I doing wrong?
Thanks so much,
-CB
Ok, am I doing something really stupid here? bregent said that I was passing the variable using post, but I'm 99% certain that is not the case. First of all, the url for my /castsupport page is
http://www.iotheatre.com/goldenage/administration/character/supportatt ributeability.php?Character_ID=&, which has a query string after the address.
Second, when I try
<?php if (!isset($_POST['Character_ID'])) print "I'm not here"; ?>, the statement prints, but <?php if (!isset($_GET['Character_ID'])) print "I'm not here"; ?> does not print.
That brings me back to my original point. Why is the value being passed through the query string Character_ID=& instead of Character_ID=14?
What am I missing? bregent, how did you determine that I was passing the value of 14 on?
thanks,
-CB
>bregent said that I was passing the variable using post, but I'm 99% certain that is not the case.
The form that you showed us was using POST, not GET.
>That brings me back to my original point. Why is the value being passed
>through the query string Character_ID=& instead of Character_ID=14?
Don't know. We'd need to take another look at your code, but it appears you have removed that page.
>What am I missing? bregent, how did you determine
>that I was passing the value of 14 on?
IIRC, that was the value populated in the Character_ID form field.
The answers are in the code. If you want help you need to show us all of the code in all of the pages involved with this workflow.
That's strange, I didn't take down the page. I'm sorry for the difficulty! The form is:
http://www.iotheatre.com/goldenage/administration/character/castsuppor t.php
The page I want to pass to is:
http://www.iotheatre.com/goldenage/administration/character/supportatt ributeability.php
The form is definately a POST form, because its attached to an update behavior. When I use the update behavior in dreamweaver, it gives me an "on submit" option. I point to the /supportattributeability.php page and hit parameters. I name the variable Character_ID and then use the "dynamic" button to select the Character_ID field from my database.
As a test, I tried putting in a static "14" in the parameter instead of the dynamic "Character_ID" value from my recordset. The URL ammended to "Character_ID=14&" and an "echo $_GET['Character_ID'] printed 14.
Thanks for the help. I need it!
-cb
We can only see the client code in the links you posted. We'd really need to see the complete code with server side scripting.
>As a test, I tried putting in a static "14" in the parameter instead of the
>dynamic "Character_ID" value from my recordset. The URL ammended to
>"Character_ID=14&" and an "echo $_GET['Character_ID'] printed 14.
Then maybe I'm looking at a different form on that page; you have several. The one I am looking at is name="castsupport". It is using POST. Forms that use POST do not add anything to the querystring.
Also, you do not need to include the '?' in your form action page name: "castsupport.php?"
Ah very sorry, I understand what you mean about the code now. I think I might have actually solved the problem, though. The original code that passes the data that dreamweaver generated was:
$updateGoTo = "supportattributeability.php?Character_ID=" . $row_rs_Casting['Character_ID'] . "";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
I changed this to:
$updateGoTo = "supportattributeability.php?Character_ID=" . $_POST['Character_ID'] . "";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
and all seems fine now. Is this a terrible hack job? Are there any problems with doing that?
Thanks for the support,
-CB
North America
Europe, Middle East and Africa
Asia Pacific