Web Scripting for Applications Revision pack

All the previous exam paper questions are available in a Web Scripting for Applications Revision Pack.

Remember that this is the first year this module has run, so the paper has a different structure to any previous second year module (details in the document above).

A solution for one of the questions is in this web scripting solution (was covered in the micro revision sessions that took place in each lecture before christmas)

3 Replies to “Web Scripting for Applications Revision pack”

  1. Some clarification here – if you wish to use checkboxes in a form, then the returned result has to be an array (because people may select more than one of the options available)

    Imagine you were supposed to vote for best subjects:

    ITB
    Web Scripting
    Marketing

    You would clearly have to pick both ITB and Web scripting

    To do this the form elements would look like this:

    input type=”checkbox” name=”module[]” value=”ITB”>ITB
    input type=”checkbox” name=”module[]” value=”WebScripting”>Web Scripting

    The returned ‘thing’ would be an array where the individual cells would be set if they had been ticked

    You could then use something like this to see which values had been selected

    $module=$_POST[‘module’];
    foreach ($module as $modulename)
    {
    print $modulename.” is checked”;
    }

  2. Here is the debug checklist that was generated in class when when of the questions was attempted in class – basically its a list you should work through to debug some supplied code

    Check for appropriate $ – in front of variables NOT in front of function names
    Check for brace pairs – { and } should match up and be in the right place
    Check number of things passed into a function (should match how its called)
    Check for returned value at the bottom of the function – should there be one?
    Check variable names are consistent
    Check loops – for loops should look like for($i= …; ….;…) or foreach
    Check for semicolons
    Look for == and = (on means test to see if equal in an if statement, the other sets the value)
    Look for wrong PHP keywords
    Check variaables are the right ones (i.e. the variable that supposed to used to create the total isn’t used as a loop counter or something)

Leave a Reply

Your email address will not be published. Required fields are marked *