Click here to Skip to main content
16,022,875 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

I am new to php. Can anybody help me to how to redirect perticular div in php page..i am using header() function but its going to default div of page but i want to go to perticular div..
thanks
Posted

In your destination page say page2.html, identify the div with id, e.g.
<div id="myplace">...</div>

Next, in you php, add this:
VB
<?php
header('Location: http://www.yoursite.com/page2.html#myplace') ;
?>
 
Share this answer
 
I'm not exactly sure what you are asking for here. I'll post an answer on a hunch and you tell me if it's what you want.

If I understand you correctly, you don't even need PHP for this... all you need to do is put the following code at the beginning of the DIV that you want to go to.

HTML
<a id="linkID"></a>


And then put the following link where you want the user to click on it to be redirected to that DIV

HTML
<a href="#linkID"></a>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900