In HTML we can create A single page site with smooth scrolling, and highlighted navigation links depending on which section is currently being viewed.To do the above in HTMl we link to this point (e.g. from the top of the page), we link using the hash character (#) and the name of the destination anchor: Go To Contact Form
The same I am Trying to Implement in PHp but I am facing Issues.
<div class="wrap">
<div class="main">
<div class="open-positions">
<?php
function readCSV($fileName) {
$rows = array();
$rows = file($fileName);
return $rows;
}
?>
<span><b>Available Positions: </b></span>
<ul>
<?php
$rows=readCSV('joinUs.csv');
$max = sizeof($rows);
for ($x=1; $x<$max; $x++) {
echo "<li> <a href='#".$rows[$x]."'>$rows[$x] |</a> </li>";
}
?>
</ul>
<div class="position" id="<?php print_r(readCSV('joinUs.csv')[1]);?>">
Job Descreption here
</div>
The Anchor Id seen while inspecting is Sr. Product Engineer and $rows[$x] is Sr. Product Engineer and both are same still Its not scrolling(from top of site on clicking the Click).
When I am hardcoding to Sr. Product Engineer it Its Working. It not working only in case of dynamic div id.While Inspecting in browser I am able to see correct div ID.
How to fix the above issue. please let me know if any other clarification is required.
Attached is the ScreenShot
I was Requested in comment to post html source code also:
<span><b>Available Positions: </b></span>
<ul>
<li> <a href='#Sr. Product Engineer
'>Sr. Product Engineer
|</a> </li><li> <a href='#Quality Assurance Engineer
'>Quality Assurance Engineer
|</a> </li><li> <a href='#Frontend Javascript Engineer
'>Frontend Javascript Engineer
|</a> </li><li> <a href='#Business Development Manager
'>Business Development Manager
|</a> </li> </ul>
</div>
<div class="position" id="Sr. Product Engineer
">
<h2 class="position-title">Sr. Product Engineer
</h2>
<div class="section">
<p>
<span class="section-title"><b>This is what we have in mind for you, the Role:</b></span>
<span class="section-description">
You will be part of the tech team and will be working closely with founders
and design team on the core product. You will be working to build new features,
fix bugs and refactor things as necessary.
</span>
</p>
<p>
<ul class="section-list">
<li>Responsible for the tech architecture</li>
<li>Take ownership of things</li>
<li>Write simple/readable code which is testable, extendable, robust and highly scalable</li>
<li>Help getting new joinees upto speed with the product</li>
<li>Suggest new features, priorities tasks and see to their completion</li>
</ul>
</p>
</div>
Please help as in above source code you can see PHP generates the same ID in html.When I am hardcoding the id It working but without hardcoding its not working.