Suedish
04-16-2004, 07:34 AM
Hiya.
I'm not very good with PHP so i would like some help, if someone could please spare the time for it. Sorry that it is long, but I wanted to get the whole code with it.
What i wanna is make all the forms mandatory to fill in, so that people can't simply refuse to enter information in one of the forms. I truly hope I can get some help with this..
(the form names are in swedish, but i hope it's ok anyway ..)
---- NEW FILE: FILE.PHP
<html>
<head>
<title>Send an email through form</title>
</head>
<body>
<form action="sendformmail.php" method="post">
<table>
<tr>
<td>Namn:</td><td><input type="text" name="namn" style="background:#DDDDDD;color:black;border:1px solid black;"></td>
</tr><tr>
<td>Företag:</td><td><input type="text" name="foretag" style="background:#DDDDDD;color:black;border:1px solid black;"></td>
</tr><tr>
<td>Telefon:</td><td><input type="text" name="telefon" style="background:#DDDDDD;color:black;border:1px solid black;"></td>
</tr><tr>
<td>E-post:</td><td><input type="text" name="epost" style="background:#DDDDDD;color:black;border:1px solid black;"></td>
</tr></table>
<table>
<tr>
<td>Ärende:<br>
<textarea name="arende" cols=30 rows=5 style="background:#DDDDDD;color:black;border:1px solid black;"></textarea></td>
</tr><tr>
<td><br><br><input type="submit" value="Submit Form"></td>
</form>
</tr></table>
</body>
</html>
--- EOF FILE.PHP
--- NEW FILE: SENFORMMAIL.PHP
<html>
<head>
<title>An email has been sent"</title>
</head>
<body>
<?php
print "Thank you <b>$_POST[namn]</b> for filling out the forms!<br><br>\n";
print "We will contact you as soon as possible\n";
//build the mail
$msg = "Namn: $_POST[namn]\n";
$msg .="Företag: $_POST[foretag]\n";
$msg .="Telefon: $_POST[telefon]\n";
$msg .="Epost: $_POST[epost]\n";
$msg .="Ärende: $_POST[arende]\n";
//config the actual mail
$mottagare = "roger.almstedt@mainline.se";
$subject = "Förfrågan från mainline.se";
$mailheaders = "From: Mainline Kontaktformulär <dettaarreply@ione.se> \n";
$mailheaders .= "Reply-To: $_POST[epost]";
//send the mail
mail($mottagare, $subject, $msg, $mailheaders);
?>
<form method="post">
<input type="button" value="Close Window"
onclick="window.close()">
</form>
</body>
</html>
I'm not very good with PHP so i would like some help, if someone could please spare the time for it. Sorry that it is long, but I wanted to get the whole code with it.
What i wanna is make all the forms mandatory to fill in, so that people can't simply refuse to enter information in one of the forms. I truly hope I can get some help with this..
(the form names are in swedish, but i hope it's ok anyway ..)
---- NEW FILE: FILE.PHP
<html>
<head>
<title>Send an email through form</title>
</head>
<body>
<form action="sendformmail.php" method="post">
<table>
<tr>
<td>Namn:</td><td><input type="text" name="namn" style="background:#DDDDDD;color:black;border:1px solid black;"></td>
</tr><tr>
<td>Företag:</td><td><input type="text" name="foretag" style="background:#DDDDDD;color:black;border:1px solid black;"></td>
</tr><tr>
<td>Telefon:</td><td><input type="text" name="telefon" style="background:#DDDDDD;color:black;border:1px solid black;"></td>
</tr><tr>
<td>E-post:</td><td><input type="text" name="epost" style="background:#DDDDDD;color:black;border:1px solid black;"></td>
</tr></table>
<table>
<tr>
<td>Ärende:<br>
<textarea name="arende" cols=30 rows=5 style="background:#DDDDDD;color:black;border:1px solid black;"></textarea></td>
</tr><tr>
<td><br><br><input type="submit" value="Submit Form"></td>
</form>
</tr></table>
</body>
</html>
--- EOF FILE.PHP
--- NEW FILE: SENFORMMAIL.PHP
<html>
<head>
<title>An email has been sent"</title>
</head>
<body>
<?php
print "Thank you <b>$_POST[namn]</b> for filling out the forms!<br><br>\n";
print "We will contact you as soon as possible\n";
//build the mail
$msg = "Namn: $_POST[namn]\n";
$msg .="Företag: $_POST[foretag]\n";
$msg .="Telefon: $_POST[telefon]\n";
$msg .="Epost: $_POST[epost]\n";
$msg .="Ärende: $_POST[arende]\n";
//config the actual mail
$mottagare = "roger.almstedt@mainline.se";
$subject = "Förfrågan från mainline.se";
$mailheaders = "From: Mainline Kontaktformulär <dettaarreply@ione.se> \n";
$mailheaders .= "Reply-To: $_POST[epost]";
//send the mail
mail($mottagare, $subject, $msg, $mailheaders);
?>
<form method="post">
<input type="button" value="Close Window"
onclick="window.close()">
</form>
</body>
</html>
