close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Retaining URL Variable

Thread begun 6/11/2010 7:50 am by gjdunn405023 | Last modified 6/30/2010 6:09 pm by Jimmy Wu | 5093 views | 23 replies |

gjdunn405023

Retaining URL Variable

I can't find a way to keep a URL variable through the Login process. It works fine once the User is Logged In, but the variable gets lost if the User needs to go through the Login and Profile pages.

Any help appreciated.

Sign in to reply to this post

Jimmy Wu

The reason for this is that the successRedirect is hardcoded to users_Profile.php and the faileRedirect is hardcoded to loop back to the login page with a failed url variable. You would want to append any of the url variables to that dynamically if you wanted to retain them. Make sure you don't append the failed=1 to the successRedirect if there is one.

On your users_Login.php page, you would want to make these modifications on these lines:
"successRedirect" => "users_Profile.php",
"failRedirect" => "users_LogIn.php?failed=1",

The successRedirect is in two places.

Sign in to reply to this post

gjdunn405023

Can I add the code as follows:

"successRedirect" => "users_Profile.php?php echo $row_rsDispatches['DSerial']; ?"

Regards.

Sign in to reply to this post

gjdunn405023

Sorry. I forgot to add the second part.

Or, should I use "?php echo $_GET['DSerial']; ?"

Regards again.

Sign in to reply to this post

Jimmy Wu

The way you're doing it it will just be used as text, so the url will be "users_Profile.php?php echo $row_rsDispatches['DSerial']; ?". You would want to append the variables (not using echo), just string concatenation.

Sign in to reply to this post

gjdunn405023

I don't understand the answer; could you correct my example for me, using the 'DSerial' variable?

Regards.

Sign in to reply to this post

Jimmy Wu

"successRedirect" => "users_Profile.php?" . $row_rsDispatches['DSerial'];

you can't start a php block within a string the way you did it. In this case, the DSerial should have a string value in it, so you can just append it to the string.

Sign in to reply to this post

gjdunn405023

Although that change seems to have worked, the variable still doesn't pass through users_Profile.php to the final protected page. Is there a similar setting in users_Profile.php that needs to be changed?

Regards.

Sign in to reply to this post

Jimmy Wu

sorry, I meant to write it out like this:
"successRedirect" => "users_Profile.php?" . "DSerial=" . $row_rsDispatches['DSerial'];

A colleague pointed out that if you just change the action of the form to this:
action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>"

That should get you on your way.

Sign in to reply to this post

gjdunn405023

The current form action is slightly different:

<form action="<?php echo ($_SERVER["PHP_SELF"].(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" name="WAATKLogInForm" id="WAATKLogInForm">

The brackets don't balance in your sample. Could you just revise this code to what it should be? Much appreciated.

Regards.

Sign in to reply to this post
loading

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