Thanks for the reply. This was an old cgi file and I'm changing it to use php. Annoyingly, I've got it working with MySQL, but I've just been told not to use it!
vet.html (form bit- indentation removed) (most of this is irrelevant- troublesome part in bold)
=====================================================================
<FORM METHOD="POST" ACTION="sendmail.php">
<INPUT TYPE="hidden" NAME="menu" VALUE="menu">
Please enter your email address <font color="red">(required)</font>
<input name="email" size="20">
<br>
<TABLE CELLPADDING=2 cellspacing="2" width="90%">
<TR>
<TD>Your Name:</TD>
<TD><INPUT TYPE=TEXT SIZE=40 NAME=name></TD>
</TR>
</table>
<table>
<TR>
<TD COLSPAN=2><HR noshade size="1">
<TR>
<TD VALIGN=TOP>AUTHOR(S), EDITOR(S) etc. (Surname, Forename):</TD>
<TD><TEXTAREA NAME=author ROWS=2 COLS=40></TEXTAREA></TD>
</TR>
<TR>
<TD VALIGN=TOP>TITLE (and series):</TD>
<TD><TEXTAREA NAME=title ROWS=3 COLS=40></TEXTAREA></TD>
</TR>
</TD>
</TR>
</TABLE>
<table cellpadding=2 width="90%">
<tr>
<td> ISBN: </td>
<td><input type=TEXT name=ISBN size=10></td>
<td> Place of Publication/Publisher:<br></td>
<td><input type=TEXT name=placeandpublisher size=20></td>
</tr>
<tr>
<td> Year: </td>
<td><input type=TEXT name=dateofpublication size=15></td>
<td></td>
<td></td>
</tr>
<tr>
<td> Edition: </td>
<td><input type=TEXT name=edition size=15></td>
<td align="right"> Price (currency):</td>
<td><input type=TEXT name=price size=15></td>
<td></td>
</tr>
</table>
<hr width="60%" noshade size="1">
<table width="95%">
<TR>
<TD VALIGN="top">Is this item already in stock?</TD>
<TD VALIGN="top" width="200"><INPUT TYPE="TEXT" NAME="instock" value="No" SIZE="3"><a href="
http://catalogue.lib.ed.ac.uk/" target="_refresh">Check the Catalogue</a> <br> <small>(Opens in new window/tab)</small></TD>
<TD> </TD>
</TR>
<TR>
<TD>Library site(s) item is to be purchased for:</TD>
<TD><INPUT TYPE="TEXT" NAME="site" SIZE="40"></TD>
<TD> </TD>
<TD> </TD>
</TR>
</table>
<table>
<tr><td>School <font color="red">(required) </font></td>
<?php
$vetarray = array( array ("0", "", ""),
array("*", "", ""),
array("1","PG/staff (M/050)","
emails@blah.com"),
array("2","MBChB (M/051)","
emails@blah.com "),
array("3","Biomedical Sciences (M/052)","
emails@blah.com "),
array("4","
emails@blah.com "),
array("5","[Test location: For Library Use] (nocode)","
emails@blah.com "));
for ($row = 0; $row < 8; $row++)
{ $vettopic=$vetarray[$row][0];
$school=$vetarray[$row][1];
$options.="<OPTION VALUE=\"$vettopic\">".$school.'</option>';
}
?>
<td><select name="topic" size="1">
<OPTION value=0>Please choose a school</option>
<?php echo $options ?>
</select>
<?php
$vettopic =( $_POST['topic']);
$school = $vetarray[$vettopic][1];
$whoto = $vetarray[$vettopic][2];
?>
<INPUT TYPE="HIDDEN" NAME = "whoto" value = "<?php echo $whoto; ?>">
<INPUT TYPE="HIDDEN" NAME = "school" value = "<?php echo $school; ?>">
</td>
</tr>
<table width="95%">
<TD VALIGN="top" colspan="4">Number of copies for: <font color="red">(required for each box)</font><br></TD>
</TR>
<TR>
<TD align="center" VALIGN="top" width="25%">Reserve <br><small>[3 hours/overnight]</small> :<br><INPUT TYPE="TEXT" NAME="ReserveCopies" SIZE="2" value="0"></TD>
<TD align="center" VALIGN="top" width="25%">Short Loan <br><small>[1 wk]</small>:<br><INPUT TYPE="TEXT" NAME="SLCopies" SIZE="2" value="0"></TD>
<TD align="center" VALIGN="top" width="25%">Standard <br><small>[UG 4 wks; PG & Staff 12 wks]</small>:<br> <INPUT TYPE="TEXT" NAME="StandardCopies" SIZE="2" value="0"></TD>
<TD align="center" VALIGN="top" width="25%">Reference:<br><br><INPUT TYPE="TEXT" NAME="RefCopies" SIZE="2" value="0"></TD>
</TR>
</table>
<TABLE cellpadding="2" cellspacing="2" border="0" width="90%">
<tr>
<td colspan="2"><a href="/services/loanperiods.html" target="_blank">What's the most appropriate loan period?</a> <small>(Link opens in new window/tab)</small>
<p>If this material is for the Reserve Collection please give the following information:</p></td>
</tr>
<tr>
<TD>Course name: </TD>
<TD align="left"><TEXTAREA NAME="CourseName" COLS="40" ROWS="1"></TEXTAREA> </TD>
</TR>
<TR>
<TD colspan="2"> <a href="
http://www.lib.ed.ac.uk/resources/colle ... intro.html" target="_blank">Find out about E-Reserve</a> <small>(Link opens in new window/tab)</small></TD>
</TR>
</table>
Enter any notes or comments (e.g. Funds, Bookseller cat. no. etc.):<br />
<TEXTAREA NAME="comment" ROWS="2" COLS="55">Notes/Comments: [Nothing entered]</textarea>
<p>
<B>Submit request</B>
<input type="submit" value="Send">
<B>Clear this form</B>
<input type="reset" value="Clear">
</form>
sendmail.php (this works for everything else- I just can't get the 'whoto'/'school' fields down)
=====================================================================
<?php
$return = 0;
if ($_REQUEST['email'] == NULL)
{
$error = "emailerror";
header( "Location: error.php?error=$error" );
$return = 1;
}
else
{
$email = $_REQUEST['email'];
}
$name = $_REQUEST['name'] ;
$author = $_REQUEST['author'] ;
$title = $_REQUEST['title'] ;
$ISBN = $_REQUEST['ISBN'] ;
$placeandpublisher = $_REQUEST['placeandpublisher'] ;
$dateofpublication = $_REQUEST['dateofpublication'] ;
$edition = $_REQUEST['edition'] ;
$price = $_REQUEST['price'] ;
$instock = $_REQUEST['instock'] ;
$site = $_REQUEST['site'] ;
$reserve = $_REQUEST['ReserveCopies'] ;
$short = $_REQUEST['SLCopies'] ;
$standard = $_REQUEST['StandardCopies'] ;
$reference = $_REQUEST['RefCopies'] ;
$coursename = $_REQUEST['CourseName'] ;
$comment = $_REQUEST['comment'] ;
$whoto = '';
$subject = '';
$emailSubject = '';
$concatenated_message = '';
$concatenated_message .= 'Name: ';
$concatenated_message .= $name."\n";
$concatenated_message .= 'School: ';
if (isset($_REQUEST['vettopic']))
{
$whoto = $_REQUEST['whoto'];
echo $whoto;
$school = $_REQUEST['school'];
echo $school;
$concatenated_message .= $school."\n";
$concatenated_message .= 'Who To: ';
$concatenated_message .= $whoto."\n";
$emailSubject = 'Vet Feedback Form Results';
$form = 'VET';
}
else
{
header( "Location: error.php?error=$topic" );
}
if (isset($_REQUEST['humtopic']))
{
$whoto = $_REQUEST['email'];
$concatenated_message .= $whoto."\n";
$emailSubject = 'Humanities Feedback Form Results';
$form = 'HUM';
}
else
{
header( "Location: error.php?error=$topic" );
}
if (isset($_REQUEST['scitopic']))
{
$whoto = $_REQUEST['email'];
$concatenated_message .= $whoto."\n";
$emailSubject = 'Science Feedback Form Results';
$form = 'SCI';
}
$concatenated_message .= 'Author: ';
$concatenated_message .= $author."\n";
$concatenated_message .= 'Title: ';
$concatenated_message .= $title."\n";
$concatenated_message .= 'ISBN: ';
$concatenated_message .= $ISBN."\n";
$concatenated_message .= 'Place And Publisher: ';
$concatenated_message .= $placeandpublisher."\n";
$concatenated_message .= 'Date Of Publication: ';
$concatenated_message .= $dateofpublication."\n";
$concatenated_message .= 'Edition: ';
$concatenated_message .= $edition."\n";
$concatenated_message .= 'Price: ';
$concatenated_message .= $price."\n";
$concatenated_message .= 'In Stock? ';
$concatenated_message .= $instock."\n";
$concatenated_message .= 'Site: ';
$concatenated_message .= $site."\n";
$concatenated_message .= 'Number of copies (Reserve): ';
$concatenated_message .= $reserve."\n";
$concatenated_message .= 'Number of copies (Short Loan): ';
$concatenated_message .= $short."\n";
$concatenated_message .= 'Number of copies (Standard): ';
$concatenated_message .= $standard."\n";
$concatenated_message .= 'Number of copies (Reference): ';
$concatenated_message .= $reference."\n";
$concatenated_message .= 'Course Name: ';
$concatenated_message .= $coursename."\n";
$concatenated_message .= 'Comments: ';
$concatenated_message .= $comment."\n";
if ($return == 0)
{
mail( $whoto, $emailSubject,$concatenated_message, "From: $email" );
mail( $email, 'Acknowledgement- Book Recommendation',$concatenated_message.'Thank You. You done well', "From: $whoto" );
header( "Location: thanks.php?name=$name&author=$author&title=$title&isbn=$ISBN&subject=$subject&email=email&whoto=$whoto&form=$form" );
}
?>
Thanks again. I'll just repeat the array in sendmail.php if there's no obvious solution!