macattack Posted June 10, 2008 Share Posted June 10, 2008 I have the following function function displayBlogsButtons($dir = '../blogs'){ foreach(scandir($dir) as $entry) if($entry != '.' && $entry != '..' && $entry != '.svc') { $entry = $dir.'/'.$entry; if(is_dir($entry)) { $path = pathinfo($entry); $listarray[$path['blogs']] = listblogs($entry); } else { $path = pathinfo($entry); $listarray[] = $path['blogs']; print ('<tr><td> <a href="index.php?blog=$entry&view=true">$path[\'filename\']</a> </td><td> <form action="index.php" method="post"> <input type="hidden" name="blog" value="$entry"> <input type="hidden" name="title" value="$path[\'filename\'> <input type="submit" name="edit" value="Edit"> <input type="submit" name="delete" value="Delete"> </form> </td></tr><br> '); } } } and it should be printing that form after each entry. However, all I am seeing is the link to the post, and no form afterwards. The table is opened and closed in another function, here: function displayEditDeleteBlogForm(){ print ("<a href='..'>Editor Home</a><br>"); print ("<h2>Edit/Delete Blog Entries</h2>"); print ("<table>"); displayBlogsButtons(); print ("</table>"); } the code generates no error messages and shows the links to every post, as requested. Could anyone suggest why the form won't generate? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 10, 2008 Share Posted June 10, 2008 Take a look at the HTML in the processed page. I can see at least a ouple of problems which may, or may not, be related to your specific problem. For example, you are printing strngs using single quotes and you have varialbes inside the string. Variable are only interprested inside strings created with double quotes. Also, you have a HTML break tag at the end of the TR closing tag for the form. It shouldn't screw up the form, but it is not valid HTML to have "content" inside a table that is not inside TD tags. There's no telling how each brower will interpret that. Quote Link to comment Share on other sites More sharing options...
macattack Posted June 10, 2008 Author Share Posted June 10, 2008 Thanks for your help. The quotations mistake was rather silly. I've made the following modification to the code: { $path = pathinfo($entry); $listarray[] = $path['blogs']; $filename = $path['filename']; print ("<tr><td> <a href='index.php?edit=EditIt&view=true&blog=$entry>$filename</a> </td><td> <form action='index.php' method='post'> <input type='hidden' name='blog' value='$entry'> <input type='hidden' name='title' value='$filename'> <input type='submit' name='edit' value='Edit'> <input type='submit' name='delete' value='Delete'> </form> </td></tr> "); } } but I've noticed two problems, and I can't figure out how to fix them. The edit=EditIt&view=true portion of the link doesn't appear, it just goes straight to the "blog" value. (outputs: index.php?blog=DIRECTORY.php). It still isn't displaying the form. I have tried in Safari and Firefox. Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 11, 2008 Share Posted June 11, 2008 The part about part of the text "disappearing" is very odd. I don't see how that could possibly happen with the code you have. When I run into these types of problems I will sometimes remove all the code from the effected area and then add a line (or a few lines) back in and then test. If those linse work correctly I will ad a few more back and so on. Once it "breaks" I know the line(s) of code that are causing the problem. Quote Link to comment Share on other sites More sharing options...
macattack Posted June 13, 2008 Author Share Posted June 13, 2008 Thanks for the suggestion. I had tried that, but it didn't seem to do anything. I believe I had commented out fairly big blocks. I will make another, more specific, attempt when I have time again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.