close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dynamic back button depend on reference

Thread began 10/16/2020 2:52 am by Jonas | Last modified 10/16/2020 2:40 pm by Ray Borduin | 18 views | 5 replies |

Jonas

Dynamic back button depend on reference

Is it possible to create a dynamic back button that goes back to the page you came from? For example, if it comes from cocacola.php or starwars.php, the back button should go back to the respective page.

Now I have a static back button:
<a class="back" href="cocacola.php<?php echo(isset($_GET["pageNum_WADAproducts_details"])?"?pageNum_WADAproducts_details=".intval($_GET["pageNum_WADAproducts_details"]):""); ?>#rec-<?php echo($WADAproducts_details->getColumnVal("product_id"));?>" id="BackToResults" role="button">Back
</a>

This means that I have to have a duplicate where only the link is changed, which does not seem optimal.

The cocacola.php and starwars.php looks different, so I need those to be individual.

Here is the link code from cocacola.php page:
<a href="CcMoreinfo.php? product_id=<?php echo($WADAproducts->getColumnVal("product_id")); ?>
<?php echo(isset($_GET["pageNum_WADAproducts"])?"& pageNum_WADAproducts =".intval($_GET["pageNum_WADAproducts"]):""); ?>" data-toggle="tooltip" data-placement="top" title="<?php echo($pageNum_WADAproducts->getColumnVal("product_description")); ?>">
</a>

Here is the link code from the starwars.php page:
<a href="SwMoreinfo.php?product_id=<?php echo($WADAproducts->getColumnVal("product_id")); ?>
<?php echo(isset($_GET["pageNum_WADAproducts"])?"&pageNum_WADAproducts=".intval($_GET["pageNum_WADAproducts"]):""); ?>" ><?php echo($WADAproducts->getColumnVal("product_name")); ?>
</br>
<?php echo($WADAproducts->getColumnVal("product_description")); ?>
</a>

But I want the link go to same page, not CcMoreinfo.php and SwMoreinfo.php.

Attached is a conceptual image

Sign in to reply to this post

Ray BorduinWebAssist

Add a reference to the previous page in the url when you link to the page. Then you can use that to set the return url.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jonas

Can you please give an example based on my example, thanks!

Sign in to reply to this post

Ray BorduinWebAssist

Here is the link code from cocacola.php page:
<a href="CcMoreinfo.php? product_id=<?php echo($WADAproducts->getColumnVal("product_id")); ?>
<?php echo(isset($_GET["pageNum_WADAproducts"])?"& pageNum_WADAproducts =".intval($_GET["pageNum_WADAproducts"]):""); ?>&return=cocacola.php" data-toggle="tooltip" data-placement="top" title="<?php echo($pageNum_WADAproducts->getColumnVal("product_description")); ?>">
</a>

here is the back button link:
<a class="back" href="<?php echo($_GET["return"]); ?><?php echo(isset($_GET["pageNum_WADAproducts_details"])?"?pageNum_WADAproducts_details=".intval($_GET["pageNum_WADAproducts_details"]):""); ?>#rec-<?php echo($WADAproducts_details->getColumnVal("product_id"));?>" id="BackToResults" role="button">Back
</a>

Sign in to reply to this post
Did this help? Tips are appreciated...

Jonas

Nice, thanks!
Is it possible to truncate the URL adress, so everything after CcMoreinfo.php disappear (question mark and everything else after)?

Sign in to reply to this post

Ray BorduinWebAssist

Just get rid of that part like:

here is the back button link:
<a class="back" href="<?php echo($_GET["return"]); ?>" id="BackToResults" role="button">Back
</a>

Sign in to reply to this post
Did this help? Tips are appreciated...

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