Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

PHP Question

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

TWM

Web Marketing SpecialistEstablished Member
Impact
9
In HTML, you can type for example:

<a href="index.html#paragraph2">Paragraph2</a>

And next to the second paragraph, you put:

<a name="paragraph2" id="paragraph2"></a>

When you click the link, it takes you to the second paragraph... How do you do this in PHP?
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
idevisedesign said:
In HTML, you can type for example:

<a href="index.html#paragraph2">Paragraph2</a>

And next to the second paragraph, you put:

<a name="paragraph2" id="paragraph2"></a>

When you click the link, it takes you to the second paragraph... How do you do this in PHP?

If I get what you are asking you would do the following:

<?php
......php code here
?>
<a href="index.html#paragraph2">Paragraph2</a>

<? ... php continues ?>

<a name="paragraph2" id="paragraph2"></a>

<? ....continue on with php

//end of php
?>
 
0
Close
Or:

echo '<a href="index.html#paragraph2">Paragraph2</a>';
 
0
Close
I am saying that all extensions are being changed to php, so instead of
<a href="index.html#paragraph2">Paragraph2</a>

I basically need something like
<a href="index.php#paragraph2">Paragraph2</a>

The one with the php extension wont work. What should i replace the "#" with so that it works with a .php extension?
 
0
Close
if it is within the php tags (<?php and ?>) then im sure the # has to be escaped so try:-

<a href="index.php\#paragraph2">Paragraph2</a>
 
0
Close
idevisedesign said:
I am saying that all extensions are being changed to php, so instead of
<a href="index.html#paragraph2">Paragraph2</a>

I basically need something like
<a href="index.php#paragraph2">Paragraph2</a>

The one with the php extension wont work. What should i replace the "#" with so that it works with a .php extension?

It should work regardless of page extension, it can be "foo.bar#paragraph2" and should still work. Try making sure you're name anchors are properly labelled and working. It's got nothing to do with php.

Cheers
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back