Hjælp til modificering af php-fil
Jeg har fået en til at lave nedenstående fil til mig - idet jeg ikke selv kan lave php.Men jeg har brug for en mindre ændring:
Det sted, hvor der bliver checket for at man vælger eet og kun eet array, skal man i stedet vælge MINDST eet - og så skal svarene selvfølgelig sendes med.
En der gider hjælpe?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Ny</TITLE>
<!-- Minus AutoDato -->
<META NAME="Generator" CONTENT="Stone's WebWriter 3.5">
<LINK REL="stylesheet" HREF="../css/sommer.css" TYPE="text/css">
</HEAD>
<BODY BACKGROUND="../pics/orange-1.gif" leftmargin="5" topmargin="4">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width=13><A href="../index.htm"><IMG
height=23 alt="" src="../pics/retur.gif" width=17 align=bottom
border=0></A> <BR><IMG height=1 alt="" src="" width=19 align=bottom
border=0> </TD>
<TD vAlign=top noWrap align=left width="3%"><A
href="../index.htm"><IMG height=19
alt="" src="../pics/www.gif" width=143 align=bottom
border=0></A> <BR></TD>
<TD align=middle><IMG height=1 alt="" src="../pics/skub.gif" width=200
align=bottom border=0> </TD></TR></TBODY></TABLE>
<CENTER>
<TABLE cellSpacing=0 cellPadding=0 width=700 border=0><TR><TD>
<IMG SRC="katbe-g.gif" BORDER="0" WIDTH="204" HEIGHT="29" ALIGN="bottom" ALT=""><BR>
<span class="txt">
<?php
if (count($_POST) > 0) {
trimdata($_POST); //remove whitespace
extract($_POST,EXTR_OVERWRITE); //overwrite existing vars with the posted vars
}
if ($submit) {
//form validation
$error = array();
if (!$name) {
$error[] = "Angiv venligst dit navn";
}
if (!$address) {
$error[] = "Angiv venligst din adresse";
}
if (!$zipcode) {
$error[] = "Angiv venligst dit postnr.";
}
if (!$city) {
$error[] = "Angiv venligst bynavn";
}
if (!$checkbox0 && !$checkbox1) {
$error[] = "Husk at vælge";
}
if (!$radio) {
$error[] = "Husk at foretage valg";
}
//only send mail if there's no errors
if (count($error) == 0) {
//give user a message depending on checkbox choice
if ($checkbox0 && !$checkbox1) {
$text_msg = 'S';
} elseif ($checkbox1 && !$checkbox0) {
$text_msg = 'V';
} elseif ($checkbox0 && $checkbox1) {
$text_msg = 'S- og V';
}
$message = $name."\n";
$message .= $address."\n";
$message .= $zipcode." ".$city."\n";
$message .= "\n";
$message .= $text_msg."\n";
$message .= "Valg: ".$radio."\n";
echo("Tak for din melding om ");
echo $text_msg;
mail('ntg@mail.dk', 'Tilbagemelding', $message);
;?>
<p><a href="../index.html">Klik her for at fortsætte</a></p>
<?php
//if errors, give user some info...
} else {
echo join("<br>",$error);
}
}
//show the form, if it is not sent, or errors ocurred
if (!$submit || count($error) > 0) {
$radio_ary = array();
$radio_ary[1] = 'J';
$radio_ary[2] = 'P';
$radio_ary[3] = 'I';
$radio_ary[4] = 'B';
$radio_ary[5] = 'F';
$radio_ary[6] = 'I';
$radio_ary[7] = 'C';
$radio_ary[8] = 'S';
$radio_ary[9] = 'F';
$radio_ary[10] = 'M';
$radio_ary[11] = 'A';
?>
<form action="index.php" method="post">
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD valign="top">
<TABLE WIDTH="200" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR><TD><span class="txt">
Navn
</TD><TD>
<input type="text" name="name" value="<?= $name?>">
</TD></TR>
<TR><TD><span class="txt">
Gade
</TD><TD>
<input type="text" name="address" value="<?= $address?>">
</TD></TR>
<TR><TD><span class="txt">
Postnr
</TD><TD>
<input type="text" name="zipcode" value="<?= $zipcode;?>">
</TD></TR>
<TR><TD><span class="txt">
By
</TD><TD>
<input type="text" name="city" value="<?= $city?>">
</TD></TR>
</TABLE>
<BR><BR>
<span class="txt">
Vi vil bede dig...
</TD><TD width="150" align=center valign=top><span class="txt">
<IMG SRC="so.jpg" BORDER="0" WIDTH="150" HEIGHT="216" ALIGN="bottom" ALT=""><BR>
S<BR>
<input type="checkbox" name="checkbox0" value="checkbox0" <?php if ($checkbox0) print "checked";?>
</TD><TD width="40">
</TD><TD width="150" align=center valign=top><span class="txt">
<IMG SRC="vi.jpg" BORDER="0" WIDTH="150" HEIGHT="216" ALIGN="bottom" ALT=""><BR>
V<BR>
<input type="checkbox" name="checkbox1" value="checkbox1" <?php if ($checkbox1) print "checked";?>
</TD></TR></TABLE>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0"><TR>
<TD width=100%>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table cellpadding="2" cellspacing="0" border="0">
<?php
foreach ($radio_ary as $key => $value) {
if ($radio == $value) $checked = "checked";
print "<tr><td><span class=\"txt\">
".$value."</td><td><input type=\"radio\" name=\"radio\" value=\"".$value."\" ".$checked."></td></tr>";
unset($checked);
}
?>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="right"><BR><BR>
<input type="submit" name="submit" value="Send "></td>
</tr>
</table>
</form>
<?php
}
?>
</TD></TR></TABLE>
