Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hey,
Could anyone on here please provide me with a simple PHP-based form i could load into a normal html page that would send an email to my email address from a form alot like this one here i tried setting up off a guide (http://www.arukknet.com/mail.php) the guides page was (http://www.ibdhost.com/contact/). There are tonnes of these on the internet but i do not understand any of their guides so if someone could please explain. thankyou.ArukkNet Homepage -- My.. Under Construction Currant Project.
Feel like helping? PM me.

Here's one method using PHP. Note, I stripped out the formatting for brevity sake, so you would need to customize your format. I'd also recommend adding in additional data validation.
<?
if ($form_submitted) {
if (!$Name) {
$er_message[] = "* Please enter your <u>name.</u>";
}
if (!$Email) {
$er_message[] = "* Please enter your <u>email.</u>";
}
if (!$Company_Dept) {
$er_message[] = "* Please select the <u>department.</u>";
}
if (!$UserComment) {
$er_message[] = "* Please enter <u>your message.</u>";
}
if ($er_message) {
?>
Please fill in:
<?
foreach ($er_message as $key => $value) {
echo "$value";
}
?>
<?
}
if (!$er_message) {$message = "email message
Name: $Name
Email: $Email
Attention: $Company_Dept
Message: $UserComment
\n";
$subject = "email message";
$to2 = "email@domainname.com";
$to_fmt2 = "Admin";
$from2 = "no-reply@domainname.com";
$from_fmt2 = "your company";
$headers2 .= "From: $from_fmt2 <$from2>\r\n";
mail($to2, $subject, $message, $headers2);
}
}
?>
<? if (!$form_submitted || $er_message) { ?><form action="<?="$PHP_SELF"?>" method="post" class="style-C">
<input name="Name" type="text" class="capsule" id="Name" value="<?="$Name";?>" size="25" maxlength="30" />
Email:
<input name="Email" type="text" class="capsule " id="Email" value="<?="$Email";?>" size="30" maxlength="50" /><
Attention:
<select name="Company_Dept" id="Company_Dept">
<option value="" <? if (!$Company_Dept) { echo "selected"; } ?>>Select One</option>
<OPTION value="Sales and Billing" <? if ($Company_Dept == "Sales and Billing") { echo "selected"; } ?>>Sales and Billing</option>
<OPTION value="Support" <? if ($Company_Dept == "Support") { echo "selected"; } ?>>Support</option>
<OPTION value="Webmaster" <? if ($Company_Dept == "Webmaster") { echo "selected"; } ?>>Webmaster</option>
</select>
Mail Message:
<textarea rows="10" cols="45" id="UserComment" value="<?="$UserComment";?>" maxlength="60" name="UserComment" class="inputTextWideStacked"style="style-B "></textarea>
<input name="Reset2" type="reset" class="capsule" value="Reset" />
<input name="Submit2" type="submit" class="capsule" value="Submit" />
<input type="hidden" name="form_submitted" value="1" />
</form>
<? }
?>

Cool as, ill put it into practice and see how far i get. Thanks tonnes, it looks slightly more into it than mine does ;). Ill edit this post once im finished :P
ArukkNet Homepage -- My.. Under Construction Currant Project.
Feel like helping? PM me.

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |