I have a div id=example in html the url would be www.mysite.com#example. Now i want to refer that in php url below with index#example
<?php
if($page <=1 )
{
echo '<span id="page_links" style="font-weight:bold;"> || </span> ';
}
else
{
$j = $page- 1;
echo '<span><a id="page_a_link" href="index?&page=' . $j . '" style="color:#ac5f42"> Prev </a></span> ';
}
for($i=1; $i <= $total_pages; $i++)
{
if($i<>$page)
{
echo '<span><a href="index?&page=' .$i. '" id="page_a_link" style="color:#5fbf7f">' . $i . '</a></span>  ';
}
else
{
echo '<span id="page_links" style="font-weight:bold;">' . $i . '</span> ';
}
}
if($page == $total_pages )
{
echo '<span id="page_links" style="font-weight:bold;">||</span> ';
}
else
{
$j = $page + 1;
echo '<span><a href="index?&page=' .$j. '" id="page_a_link" style="color:#ac5f42"> Next </a></span>';
}
?>
My Answer:
No, it is not possible to pass an HTML div ID directly into a PHP URL. The div ID is a client-side element and is not accessible in the server-side PHP code. If you need to pass information from the client-side to the server-side, you can use JavaScript to capture the div ID and send it to the server via an AJAX request or by including it as a parameter in a form submission.
Rate this post
5 of 5 based on 4259 votesComments