JBridge

JBridge: Certification Question Of The Day

JBridge Home >> Certification Questions >> Today's Question Last updated: Monday 28th April 2003

Consider the following HTML page.
 <HTML>
 <HEAD>
 </HEAD>
 <BODY>
 <FORM ACTION='QueryStringPrinter'>
   <SELECT NAME='Composer' MULTIPLE>
     <OPTION VALUE='Brahms'>Brahms
     <OPTION VALUE='Chopin'>Chopin
     <OPTION VALUE='Liszt'>Liszt
     <OPTION VALUE='Schubert'>Schubert
   </SELECT>
   <INPUT TYPE='SUBMIT' NAME='SubmitButton' VALUE='SEND'>
 </FORM>
 </BODY>
 </HTML>
    
If you select both Brahms and Schubert, then press the submit button, what will the query string sent to the web server contain?

A Composer=Brahms,Schubert
B Composer=BrahmsSELECTED&Composer=Chopin&Composer=Liszt&Composer=SchubertSELECTED&SubmitButton=SEND
C Composer=Brahms,Schubert,SubmitButton=SEND
D Composer=Brahms&Composer=Schubert&SubmitButton=SUBMIT
E Composer=Brahms&Composer=Schubert&SubmitButton=SEND

Page down for the answer...











































The Answer


The correct answer is E, Composer=Brahms&Composer=Schubert&SubmitButton=SEND.
The essentials are: every selected value is sent as a separate name/value pair, separated by "&".
Unselected values from the SELECT tag are simply not sent (so answer B is nonsense).
The "submit" button is included in the query string, because it has a NAME ("SubmitButton") with which to associate the value.

EMail: dbridgewater@jbridge.co.uk
Phone: +44 (0)1943 877414
Fax: +44 (0)1943 877414
Mail: David Bridgewater, Willow Dene, Bradford Road, Menston, Ilkley, West Yorkshire, LS29 6ED, UK
Copyright © 2003 David Bridgewater. All rights reserved.