close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Syntax for redirect URL

Thread began 3/12/2014 1:18 pm by iainmacdonald331081 | Last modified 3/13/2014 11:23 am by Jason Byrnes | 2256 views | 7 replies |

iainmacdonald331081

Syntax for redirect URL after logging in

I have a page here with a standard login form:

http://www.safariawards.com/africa/handprintsafarilodge1/

Part the last part of the URL is dynamic, i.e. 'handprintsafarilodge1' is a field in a database.

How does the redirect URL need to look to redirect to return to the page with the same lodge listed? e.g.:

../africa/<?php echo $row_rs_Lodge['GSG_URL']; ?>

Sign in to reply to this post

Jason ByrnesWebAssist

that looks correct for the redirect URL as long as the recordset is on the page before the redirect URL.

Sign in to reply to this post

iainmacdonald331081

What should the syntax be on the line to include the PHP echo part?

"successRedirect" => "../africa/<?php echo $row_rs_Lodge['GSG_URL']; ?>/",

Sign in to reply to this post

Jason ByrnesWebAssist

"successRedirect" => "../africa/".$row_rs_Lodge['GSG_URL']."/",

Sign in to reply to this post

iainmacdonald331081

Thanks Jason - that's returning to:

../africa//

Without picking up the GSG_URL field.

Not sure if that's due to a typo or maybe the ordering of the code at the top of the page.

I've attached it to see if you can spot anything obvious.

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

Jason ByrnesWebAssist

the recordset uses a URL variable to filter. That URL varaible doesnt exist when the form is posted.

in the form tag:

<form class="Basic_Default" id="Insert_Basic_Default" name="Insert_Basic_Default" method="post" action="<?php echo (htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?>">

change the action:
action="<?php echo (htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?>"

to:
action="<?php echo(htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)."?".$_SERVER["QUERY_STRING"]); ?>"

Sign in to reply to this post

iainmacdonald331081

Thanks Jason. That works, although it does show up as:

http://www.safariawards.com/africa/handprintsafarilodge1/?GSG_URL=handprintsafarilodge1

In the browser.

I had managed to get it working by adding a session:

<?php
@session_start();
if (!isset($_SESSION["GSG_URL"])) {
$_SESSION["GSG_URL"] = "".$row_rs_Lodge['GSG_URL'] ."";
}
?>

and

"successRedirect" => "../africa/".$_SESSION["GSG_URL"]."/",

I guess either or will be OK - that extra bit on the URL isn't that big a deal.

Sign in to reply to this post

Jason ByrnesWebAssist

glad to hear you have it working.

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