Coursework FAQ

  • How do I display data as an XML file?
    I would not recommend to use PHP's builtin XML functions for this because it is easier to just use echo statements to produce the XML file. For example:
    echo htmlentities("<quiz></quiz>");
    prints the first and last tag. The htmlentities() command is necessary so that the tags are literally displayed in the browser.

  • How do I create a DTD?
    You can generate it using an XML editor. Download the Butterfly XML Editor. Click on run.bat or ButterflyXML.exe to start the editor. Click on "Create a new XML file" to edit your XML file. You can copy and paste the html file from your browser window into Butterfly by using Ctrl-c, Ctrl-v. When you are finished entering the data, right click on a tag and then select "Generate DTD".

    PHP Troubleshooting

  • It doesn't work, but it doesn't produce an error either.
    Turn error reporting on. Add "error_reporting(E_ALL);" in the line after your first "<?php". Some of the errors it shows are just warnings that you can ignore. But it might give you more hints about the problem.
  • I get an error with a line number pointing to the end of the file
    This means you forgot to close some string or expression. Check whether all your opening brackets have closing brackets. Check your quotes.
  • $_REQUEST[...] and $_POST[...] are not working
    For some reason POST is disabled by C&IT for some students. Please, use GET in your forms, if POST does not work.
    More questions will be added to this FAQ. If your question hasn't been answered, ask during the practical session, or send an email to u.priss.