hei jeg har prøvd og failet veldig lenge nå med å få inn "radio buttons" i et skjema som sendes til mailen min, lurer på om det er noen her som kan forklare meg hva jeg gjør feil?=P
PHP:
<?php
$error = "";
if(isset($_POST['submit'])){
$typea = $_POST['typea'];
$typeb = $_POST['typeb'];
$antall = $_POST['antall'];
$name = $_POST['name'];
$email = $_POST['email'];
$number = $_POST['number'];
$result = checkForSpam(Array($name));
if(trim($antall) == "" || trim($name) == "" || trim($email) == "" || trim($number) == ""){
$error = "Du må skrive inn informasjon i alle feltene";
}
else if($result){
$error = 'Du har skrevet inn ugyldige tegn.';
}
else if(!validEmail($email)){
$error = 'E.post adressen din er ugyldig';
$email = '';
}
if($error == ''){
$priority = 3;
$php_version = phpversion();
$body = <<<EOD
<br><hr><br>
Type: $typea
Type: $typeb <br>
Antall: $antall <br>
Navn: $name <br>
E-post: $email <br>
Nummer: $number <br>
EOD;
$headers = "From: $name <$email>\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "X-Priority: $priority\n";
$headers .= "X-Mailer: PHP $php_version\n";
$subject = $emailSubject;
$to_email = $recipientEmail;
mail($to_email, $subject, $body, $headers);
echo $successMessage;
}
}
if(!isset($_POST['submit']) || $error != '')
{
echo "<h1>$title</h1>";
echo $error;
?>
HTML:
<form id="form1" name="form1" method="post">
<table width="350" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" height="40" align="left">Type:</td><td><input type="radio" name="type" value="<?php echo $typea; ?>">Papirutgave
<input type="radio" name="type" value="<?php echo $typeb; ?>">PDF</td></tr>
<tr>
<td width="150" height="40" align="left">Antall:</td><td><input type="text" name="antall" size="4" value="<?php echo $antall; ?>"></td></tr>
<tr>
<td width="150" height="40" align="left">Navn:</td><td><input type="text" name="name" value="<?php echo $name; ?>"></td></tr>
<tr>
<td width="150" height="40" align="left">E-post:</td><td><input type="text" name="email" value="<?php echo $email; ?>"></td></tr>
<tr>
<td width="150" height="40" align="left">Tlf. nummer:</td><td><input type="text" name="number" value="<?php echo $number; ?>"></td></tr>
<tr>
<td></td><td><input type="submit" name="submit" value="Send bestilling"></td></tr>
</table>
</form>