close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Related form, redirection question

Thread began 2/21/2013 10:15 am by gdavis421484 | Last modified 2/21/2013 2:47 pm by gdavis421484 | 959 views | 6 replies |

gdavis421484

Related form, redirection question

I have a main table (with a Main Form: tbl_mi_details_detail.php) and a related table with a related Form: (tbl_names_insert.php).
I have a slight problem with re-direction after an Insert Action in the Related Form.

The related Form has an action in the form tag of:
<?php echo (htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?>

And an Insert Record 'After Insert' Server Behavior 'Go to' of:
tbl_mi_details_detail.php?RefNo=<?php echo ((isset($_POST["Insert_ID"]))?$_POST["Insert_ID"]:""); ?>

And a Cancel button:
<input type="button" value="Cancel" class="formButton" id="cancel" name="cancel" onclick="document.location.href='plugins/tbl_mi_details_detail.php?RefNo=<?php echo ((isset($_SESSION["Insert_ID"]))?$_SESSION["Insert_ID"]:""); ?>';" />

After inserting a new record I need to return to the Main Form with a url parameter and show the main record - as per the Cancel button above (the cancel button works correctly)

However, when I insert a record in the Related Form, the record is written to the related table but no re-direction back to the main form takes place i.e. the 'After Insert' Server Behavior does not seem to fire? (the trigger is 'Button: Current Page Submit')

I'm sure that I'm missing something simple here - any suggestions on how I get the GoTo working?.

Sign in to reply to this post

Jason ByrnesWebAssist

so the cancel button is working fine using the Insert_ID session?
onclick="document.location.href='plugins/tbl_mi_details_de tail.php?RefNo=<?php echo ((isset($_SESSION["Insert_ID"]))?$_SESSION["Insert_ID"]:""); ?>';" />


in this code, your using a form element:
tbl_mi_details_detail.php?RefNo=<?php echo ((isset($_POST["Insert_ID"]))?$_POST["Insert_ID"]:""); ?>

does that form element exist?

did you try setting the value of the Insert_ID form element to use the session variable?

<input type="hidden" name="Insert_ID" id="Insert_ID" value="<?php echo ((isset($_POST["Insert_ID"]))?$_POST["Insert_ID"]:""); ?>" />

Sign in to reply to this post

gdavis421484

Hi Jason, thank you for the reply.

so the cancel button is working fine using the Insert_ID session?
onclick="document.location.href='plugins/tbl_mi_details_de tail.php?RefNo=<?php echo ((isset($_SESSION["Insert_ID"]))?$_SESSION["Insert_ID"]:""); ?>';" />
******* Yes that works OK

in this code, your using a form element:
tbl_mi_details_detail.php?RefNo=<?php echo ((isset($_POST["Insert_ID"]))?$_POST["Insert_ID"]:""); ?>

does that form element exist?
****** Yes Insert_ID is a hidden form element that uses the SESSION variable

did you try setting the value of the Insert_ID form element to use the session variable?
****** Yes - also tried your suggestion below

<input type="hidden" name="Insert_ID" id="Insert_ID" value="<?php echo ((isset($_POST["Insert_ID"]))?$_POST["Insert_ID"]:""); ?>" />

I have attached the whole form.

Attached Files
tblnames_insert.zip
Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

gdavis421484

Hi Jason

I found this error message on the server:

[21-Feb-2013 18:49:08] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/foresttr/public_html/MI/tblnames_insert.php:2) in /home/foresttr/public_html/MI/tblnames_insert.php on line 32

Putting <? ob_start(); ?> and <? ob_flush(); ?> at the begining and end of the page gets it working as required - but I'm not sure if this is the best solution?.

This does explain why the problem did not occur on my test (WAMP) server, it only started when I uploaded the files to my live server.

Sign in to reply to this post

Jason ByrnesWebAssist

the headers already sent error is caused by output on the page between php tags.

the error is saying the problem is at line 2.

at line 1, you have the following code:
"<?php @session_start(); ?> "

i put in quotes to highlight the blank space at the end, that blank space after the closing PHP tag is the cause of the error.

Sign in to reply to this post

gdavis421484

Thank You

Thanks Jason, you are right

I removed the space and the <? ob_start(); ?> and <? ob_flush(); ?>
Now it all works as expected.

Many thanks for your help - I'll remember to look out for extra spaces in future.

Sign in to reply to this post

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