473,396 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

embed php within an HTML hyperlink

This is the code for the hyperlink on a web page.
<li class="current_page_item" ><a href="</p>http://active.com">Logout</a></li>

How do I add php code to be executed when "Logout" is clicked. I've tried adding the php code, but it continually executes the php code when the page is loaded.
Jul 14 '11 #1
3 1796
Rabbit
12,516 Expert Mod 8TB
PHP is for before it reaches the client. Which is why it is called a server side language. For something to happen on the client side, you need to use a client side language, i.e. javascript.
Jul 14 '11 #2
Markus
6,050 Expert 4TB
To log a user as 'out', you'd typically point that anchor (the <a>) at a PHP page that does the processing. Something like:

Expand|Select|Wrap|Line Numbers
  1. // Some HTML file
  2. <a href="logout.php">Log Out</a>
  3.  
  4. // logout.php
  5. <?php
  6. $user->logOut();
  7. ?>
  8.  
Jul 15 '11 #3
thanks for instruction. That worked. Here's the logout.php file I created.

<?php
//start session
session_start();

//remove session variables
session_unset();

// destroy the session
session_destroy();

?>
Jul 15 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Randi | last post by:
Hi all, I there any way of putting an html hyperlink into a .xml file, and still be able to use the xml tags to format the page? Here is the code of the xml file(real simple) and the .css file. ...
8
by: Frank Ratzlow | last post by:
Hi folks, I have a list of entries where some entries contain the special character (quotes) within in the string. If I try to save this entry everything after the quotes is skipped. The reason...
9
by: MTriggs886 | last post by:
There isn't a command that exists that can serve as an alternative to EMBED in HTML 4.01 Transitional coding, is there? I've historically used this command to play MIDI files in the background of...
1
by: Larry R Harrison Jr | last post by:
I have a webpage for showing slideshows. I got the code from http://javascript.internet.com/miscellaneous/image-slideshow.html It's very simple, clean-looking, and small-sized. The only...
0
by: Gareth Clayton | last post by:
I have imported a title list from excel to an access database table and would like to know how to change the imported URL which is long and ugly into html hyperlink code with the title name as...
1
by: mike c | last post by:
I have a search app that searches local HTML files for a specified term. I then display the pages that contain the term. I would like to highlight the search term within the HTML when it is...
5
by: Piotrekk | last post by:
Hi Having a keyword i need to search HTML file for keyword dismissing all the tags, and checking only plain text. Is there an easy way to do it in C#? Thanks PK
3
by: Vlad | last post by:
Hi! My task: Take HTML -convert into plain text. Sub-task: 1. Find all urls within HTML (<a href="http://www.abc.com">More about baby bears</a>). 2. And convert them into plain text: More...
2
by: premMS143 | last post by:
Hello Everybody, Here i'm facing one problem with VB6.0. I've prepared a project related to Computer Institution. Here, Everything is working fine. But now I want to add one new thing. The...
2
by: LindaDhasan | last post by:
Hi, I am a beginner with javascript.Please help me clarify how to display the result of a javascript function within html underline tag.PFA the code. <html> <head> <script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.