I've got a php site backend script im developing. A part of the script is a page uploader in which you give the file a title, the page a name, type in the content of the page, and then select from a drop down option list where on the sites navigation column you want the link to be displayed.
The problem is that I cant get navigation part to work correctly. I have it setup so that the script opens the index file, searches for a hidden html tag and then replaces the hidden tag with the link and a new hidden tag. In my eyes it looks like the hidden tag isn't being found and the scrip is just passing over that part becuase its not found.
Here are the parts of code that are connected to my problem. Any help at all would be appreciated greatly. Thanks!
Forms Drop List:
Navigation Spot:<br> <select name="navi"> <option value="nav1">1</option> <option value="nav2">2</option> <option value="nav3">3</option> </select>
Php script that processes the this part of the form:
//Post navigation link on index; $nav = $_POST['navi']; $SData = "<a href=\"index.php?id=$ourFileName\">$ourLinkName</a><br> <!-- $nav -->"; $data = file_get_contents("$dir/index.php"); $data = str_replace ('<!-- $nav -->', $SData, $data); $fp = fopen ("$dir/index.php", 'w'); fwrite ($fp, $data); fclose ($fp);
Hidden tags on index.php page:
<!-- nav1 --> <br> <!-- nav2 --> <br> <!-- nav3 -->