John Davidson

Is it possible to pass an html div ID into php url?

0 comments
Message:


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;"> &#124;&#124; </span>&ensp;';
}
else
{
$j = $page- 1;
echo '<span><a id="page_a_link" href="index?&page=' . $j . '" style="color:#ac5f42"> Prev </a></span>&ensp;';
}
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> &ensp;';
}
else
{
echo '<span id="page_links" style="font-weight:bold;">' . $i . '</span>&ensp;';
}
}
if($page == $total_pages )
{
echo '<span id="page_links" style="font-weight:bold;">&#124;&#124;</span>&ensp;';
}
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 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us