PDA

View Full Version : CGI scripting with HTML form help needed


Buckster_uk
12-07-2005, 10:55 PM
I am trying to create a kind of quiz using countries and their capitals. I want the user to select their answers and then when they enter them, I want the correct answers and their score to be shown on the next page. I have created HTML code for the form, but really need help with the CGI part, very inexperienced and am not sure where to go. I think I have directed it correctly in the <form> section to capitals.cgi.


<form action="/cgi-bin/capitals.cgi" method="post"
enctype="application/x-www-form-urlencoded">
<fieldset>
<legend>[<span style="background:red; color:white; font-weight:bold">
&nbsp;Exercise 2: Match a country with its capital&nbsp;</span>]</legend>
<table cellpadding="8">
<tr>
<td align="justify" colspan="4"><p>On pages 19 and 20 we developed a program that asked the user to match a capital city with its corresponding Mediterranean country. You task is to rewrite the program for the web, given the following format for the form. You may find clues in the source code of the form, though you should not feel constrained by this if you believe you have a better solution.</p></td></tr>
<tr>

<td>France:<br />
<select name="France">
<option value="0">Athens</option>
<option value="0">Madrid</option>
<option value="France">Paris</option>
<option value="0">Rome</option>

</select>
</td>
<td>Greece:<br />
<select name="Greece">
<option value="Greece">Athens</option>
<option value="0">Madrid</option>
<option value="0">Paris</option>

<option value="0">Rome</option>
</select>
</td>
<td>Italy:<br />
<select name="Italy">
<option value="0">Athens</option>
<option value="0">Madrid</option>

<option value="0">Paris</option>
<option value="Italy">Rome</option>
</select>
</td>
<td>Spain:<br />
<select name="Spain">
<option value="0">Athens</option>

<option value="Spain">Madrid</option>
<option value="0">Paris</option>
<option value="0">Rome</option>
</select>
</td>
</tr>
<tr>
<td colspan="4" align="center"><input align="middle" name="Test script" type="submit" value="Submit answers" /></td></tr>

</table>
</fieldset>
</form>

dswimboy
12-11-2005, 08:17 AM
do you want to learn, or have the answer?