Anchor Tag Help W/PHP

I'm using PHP and while this is an HTML question, I'm looking for a
PHP answer please - I've got several anchors similar to the one shown
below - I'm calling a dispatcher.php script and I need to be able to
determine which anchor was clicked on even tho they will all call the
same dispatcher.php script - in PHP can I detect which anchor was
clicked on once I'm in the dispatcher script?

<A HREF="dispatcher.php">2</A>


Anchor Tag And SERVER_ROOT In Anchor Tags?

website, and I am confused on what to do about SERVER_ROOT in my anchor tags.Right now my index page looks like:
$server = preg_replace('/(.+\/).+\..+/', "$1", $_SERVER['SERVER_ROOT']);


The file loads fine, however the links aren't working.The url becomes:


What I want is to have it just be:


I wish to correct the anchor tag problem.

View 6 Replies View Related

If Anchor Is Clicked / Echo Information On A Page After And Anchor Has Been Clicked?

I'm trying to echo information on a page after and anchor has been clicked

<a id="anchor">Information</a>

View 7 Replies View Related

Set A Var To #anchor Value?

Is it possible to use #anchors to set a variable in PHP?

For instance if I the url was

have $location = flash
Here is my code so far..
<script type="text/javascript">{
content:    '<div id="<?php echo "$location" ?>
">Welcome to my website!</div>',


View 3 Replies View Related

Redirect With Anchor Tag In IE

The following PHP code snippet works in Firefox and Opera but NOT
Internet Explorer (I'm using IE v 6.0.2xxx)

$url =
header("Location: " . $url); /* Redirect browser */

The Anchor Tag: "#AT2" generates a 505 error in Explorer. When the
Anchor Tag [#AT2] is removed from the URL everything works fine.
Any thoughts on a workaround?

View 9 Replies View Related

Anchor Position

Could anyone teach me how to set anchor for a php link?

Is the following right?

Or the following?

Or both are wrong?

Besides, could I go to anchor position by PHP command?

View 1 Replies View Related

Extracting Anchor From Url

I have a page with a bunch of anchor tags. eg:

<a name="tag1">
some text
<a name="tag2">
some more text

(In case you didn't know what anchor tags looked like!)What I want to do is write to the database when a particular anchor is requested. So for Code: <a href="page.php#tag1">
We just go to the tag. But for Code:

View 2 Replies View Related

Getting Anchor Name With Regex?

I need to capture the name of an anchor html tag with regex and php so from text I will get "hello" (the name of the anchor)

Tried that:

$regex = '/(?<=name=")#([^]+?)#(?=")/i';
preg_match_all($regex, $content, $data);

I've tailed the apache error log to find out that:

PHP Warning: preg_match_all(): Compilation failed: missing terminating ] for character class at offset 26

also tried:

$regex = '/(?<=name=")([^]+?)(?=")/i';
$regex = '/(?<=name=")[^]+?(?=")/i';

which are basically the same. I guess I'm missing something, probably a silly slash or something like that but I'm not sure as to what

View 4 Replies View Related

Linking To A Named Anchor

I've got a PHP script for a very basic CMS which links a page to itself when a "Submit" button is clicked in a form, at the same time a variable "Number" is sent, telling the script which particular "Submit" button was clicked. The following script takes place in a PHP loop using the counting variable $i: Code:

View 4 Replies View Related

Anchor Tags And PHPSESSID

Trying to pass anchor tags and the PHPSESSID together.

echo "<a href=page.phtml#".$classinfo2["cla_ins_id"]."?$sUrlSession>"

The only browser this works in is NS 4.79

View 2 Replies View Related

Jumping To Anchor After Submit

i have a form with lots of data, and when they click on a button it
calls some javascript which sets values in hidden fields then posts to
itself (usual stuff)

now the problem is that i would like to bring the page back to the
same spot after the submit (as its very long)

Ive added anchors to each button but if i add a the anchor tag to the
action part of the form, im always one click behind, ie it jumps to
the one I clicked on before. ive tried using location header etc
calling itself and appending #anchorname to the end of the url, but
then i lose the data in the form, as no $_requests have data any more.

so what i need is when you hit a button, sumit the page && go to the
correct anchor. is this possible

View 7 Replies View Related

Preg_replace - Replace Something With An Anchor Tag

I dont think I'll ever understand regular expressions ... I need to do th
efollowing and I just don't know where to start:

$haystack = "How much wood would a wood chuck chuck if a woodchuck could
chuck wood?";
$needles = ("wood","chuck","wood chuck");

I want to replace every needle with an anchor tag like this:

<a href="def.html?word=wood">wood</a>
<a href="def.html?word=chuck">chuck</a>
<a href="def.html?word=wood%20chuck">wood chuck</a>

How do I do this?

View 4 Replies View Related

Anchor And Form Submit

I need an anchor on a form action to get my page to locate properly in the browser. (I do a select lookup and propogate another select). Now that I have added the anchor:

my form only reloads and doesn't perform the right action:

is not working properly with the anchor. Does someone know how to work with anchors and not mess up the php?

View 1 Replies View Related

Dynamic Anchor Based On Last Name

I have a MySQL database that hold the list of employees. I display the page using PHP. All of this works great, I sort by last name ascending so the list is A-Z.

Here is what I want to do.

At the top of the page I want to list each letter of the alphabet and have it as a link. From that link (lets say "G") when I click on G it jumps to the first employee that has a last name that starts with G (staying on the same page)

Is there some way to create a dynamic anchor that would jump to a specific areas based on how the alphabet link was coded?

View 1 Replies View Related

Get Href From Anchor Tag With Particular Class?

If I have an HTML document, what is the best way to go through the document and gather the href values from all anchor tags with a particular class using PHP?

View 4 Replies View Related

Regular Expression Anchor Tag?

i am using php and i am having problem to parse the href from anchor tag with text.

example: anchor tag having test http:/[url.....

like this <a href="http:[url]....

i want to match all text in anchor tag

View 3 Replies View Related

Obtain Anchor Part Of URL After # ?

While using LightBox mechanism in my project I got an URL


I need to collect that patientid from this through GET mechanism, Is that possible in PHP?

View 4 Replies View Related

SELECT Statement In Anchor Tag?

page where it displays URLS, tags, and the user associated with it who is logged in after a login form was done.The tags are hyperlinks, so if a user clicks on it, it will reload the page with all the URLs associated with that tag.Im working from a database, so can i use a select statement within the anchor tag to achieve my task?

View 3 Replies View Related

Add Anchor Tag When It Add Products During Execution Or Run?

below code is creating menu like this shown about.the only one thing i need to have is that i want to put <anchor tag when it add products during execution or product4 should be in anchor tag etc.
global $menu_array;
running query
$result = mysql_query("SELECT * FROM `tblcatagory`");

fetch rows to show like tree
while ( $row = mysql_fetch_assoc($result) )
$menu_array[$row['cat_id']] = array('Categoryid'=> $row['cat_id'],'name' => $row['cat_name'],'parent' => $row['parent']);
recursive function that prints categories as a nested html unorderd list
function generate_menu($parent)
$has_childs = false;
this prevents printing 'ul' if we don't have subcategories for this category make array global
global $menu_array;
use global array variable instead of a local variable to lower stack memory requierment
foreach($menu_array as $key => $value) {
if ($value['parent'] == $parent)
{ if this is the first child print '<ul>' if ($has_childs === false) {
don't print '<ul>' multiple


MySQL Data Transfer, Source Host: localhost, Source Database: sre, Target Host:localhost, Target Database: sre, Date: 3/16/2010 2:08:56 PM */
-- ----------------------------
-- Table structure for tblcatagory
-- ----------------------------
CREATE TABLE `tblcatagory` (
`cat_id` int(10) NOT NULL AUTO_INCREMENT,
`parent` int(10) DEFAULT NULL,
`cat_name` varchar(255) DEFAULT NULL,


View 1 Replies View Related

Get Anchor Tag Text Using Javascript?

invoke a search corresponding to all links in my Wordpress blog.I am using an Ajax call for my other search in this site.How can I retrieve a linking text from hypertext tag in html.


here i want to get 'demo' as input.

View 2 Replies View Related

Get An Anchor Tag To Delete A Session?

I need to get an anchor tag to delete a session in php + log the user out of Facebook. Before I used Facebook connect, I was using this php code to destroy the session:

$_SESSION = array();
header("Location: /");

And this for the anchor tag:

<a href='?logoff'>Log Out</a>

I now need the same anchor tag to go to the $logoutUrl + destroy the session.

View 1 Replies View Related

Test If An Anchor In URL Exists And To Get Its Value

I was wondering how to test for an anchor in the URL and to get its value.

Most URLs look something like this:


But sometimes an anchor is appended to the URL:


The reason I am asking is because on my forum I want members to be able to send links to posts. To be able to do that, I need to send an anchor. However, the issue lies in that members may have different display settings so they'll be displaying a different number of posts per page than perhaps the person sending the link.

If the link sent is to the 21st post, but the person receiving it is displaying 20 posts per page, then it would be on the second page.

What I am looking to achieve is:

1) Test for an anchor's presence. If it's not there then don't worry about it.
2) If it's there, get its value and determine which post it is.
3) Once the post is determined, determine which page the post is on.
4) Once that is determined, direct the user there.

Unless there's a completely different (and easier) method of doing this.

View 6 Replies View Related

Capturing The #anchor String?

I just realized, after doing a var_dump call on the $_SERVER variable, that when a php page is accessed with an anchor value, the PHP script cannot get the #anchor data.

Is there anyway to get the anchor data in PHP?

View 1 Replies View Related

Add Anchor Tag To URL From Text Input?

I want to be able to take user inputted text in a comment field and check for URL type expression, and if it exists, add an anchor tag (to url) when the comment is displayed.

I am using PHP on the server-side, and Javascript (with jQuery) on client, so should I wait to check for URL until right before it is displayed? Or add the anchor tag before inserting it in the database?


<textarea id="comment">check out or or</textarea>


<div id="commentDisplay">check out <a href=""></a> or <a href=""></a> or <a href=""></a></div>

View 4 Replies View Related

Get Anchor Text Using DomDocument?

Say I have this html:

<a href="">Test</a>

I parse it using dom document with this code:

$dom = new DomDocument();
$urls = $dom->getElementsByTagName('a');

And then I run this code:

foreach ($urls as $url)
//echo "<br> {$url->getAttribute('href')} , {$url->getAttribute('title')}";
foreach ($url->attributes as $a)
echo "<br>$a->name is $a->value";
echo "<hr><br>";

When I do this, I only see 'href' as an attribute of the url, there's no way to get the 'anchor text' (in the above case 'Test'). How can I get the anchor text of the link?

View 3 Replies View Related

Extract The Anchor Text From The RSS?

I tired all my PHP skills to extract domain name strings from a RSS Feed and put each domain name as an array element, but all in vain:Here is the RSS: [URL}....Do you see a list of domain names, which are anchored? All I need is to extract these domain names like " uk", (there is a space between .co and .uk), which can beremoved with str_replace).Here is my first try: (Using SimpleHTMLDomParser)

$html = file_get_html('');
$domains = $html->find('div[class="entry"] a', 0);

View 1 Replies View Related

Go To Anchor Without Refreshing Page?

I have been using ajax (prototype) to generate a table with values from a mysql database. I have a administration page where someone can delete an entry. I have the script re-generate the table once someone has deleted an entry. I setup anchors into each table row and I want the page to go to the next row down. I have tried to do that but each time I try with javascript, it refreshes the page.

View 1 Replies View Related

Anchor Tag In FF; Targeting Hidden Div?

I'm having an issue with Firefox and anchor links from an external page to a tab div on the landing page; while IE render these correctly (I know, that means little), FF and Chrome both send the user to a place somewhat above or below the actual anchor tag. I didn't write the original code, but I'm not able to find much about a FF bug that would cause this, or a solution?

View 2 Replies View Related

Extracting The Anchor Text From The RSS

I tired all my PHP skills to extract domain name strings from a RSS Feed and put each domain name as an array element, but all in vain: Here is the RSS: [URL] Do you see a list of domain names, which are anchored? All I need is to extract these domain names like " uk", (there is a space between .co and .uk), which can be removed with str_replace). Here is my first try: (Using SimpleHTMLDomParser)

$html = file_get_html('');
$domains = $html->find('div[class="entry"] a', 0);
foreach($domains as $dom)
echo str_replace(' ', '.', $dom->plaintext);

Here is my another try with DOM Document:


In both the cases, DOMDocument is created but it seems the Document has all information except the domain names I want to extract.

View 1 Replies View Related

Query With Anchor Tag In Mysql?

If i click on city link give data order by city.same for username


View 1 Replies View Related

Pull Information Off An Anchor ID

I have a bunch of links that ref is the same page.  Is there any way on that second page I can tell which link was clicked if my links are structured as:

<a href="page.php" id="link1">Link 1</a>
<a href="page.php" id="link2">Link 2</a>
<a href="page.php" id="link3">Link 3</a>
<a href="page.php" id="link4">Link 4</a>

View 7 Replies View Related

Copyrights 2005-15, All rights reserved