the mail() function
Moderators: macek, egami, gesf
by inspirilizationist » Mon Oct 10, 2011 11:58 pm
Ello All,
I suck with PHP, lol, just cannot seem to understand the basics, but I am working on it. I could use some help trying to get my custom contact form to function. I followed a tutorial carefully, made a custom style and it will not function correctly. It would be awesome if some one could look over my code and point out my error. THANKS!!!
http://www.case-tech.info/contact.htmlhttp://www.case-tech.info/mail.phpDylan
-
inspirilizationist
- New php-forum User

-
- Posts: 2
- Joined: Mon Oct 10, 2011 11:52 pm
by inspirilizationist » Tue Oct 11, 2011 12:05 am
Here is the code to make it easier...
HTML Code
- Code: Select all
<style type="text/css">
/* ----------- My Form ----------- */
.myform{
margin:0 auto;
width:400px;
padding:14px;
}
/* ----------- stylized ----------- */
#stylized{
border:solid 2px #;
background:#ffffff;
}
#stylized h1 {
font-size:14px;
font-weight:bold;
margin-bottom:8px;
color:#606060;
}
#stylized p{
font-size:11px;
margin-bottom:20px;
border-bottom:solid 1px #b7ddf2;
padding-bottom:10px;
}
#stylized label{
display:block;
color:#606060;
font-weight:bold;
text-align:right;
width:140px;
float:left;
}
#stylized .small{
color:#666666;
display:block;
font-size:11px;
font-weight:normal;
text-align:right;
width:140px;
}
#stylized input{
float:left;
font-size:12px;
padding:4px 2px;
border:solid 1px #17a21d;
width:200px;
margin:2px 0 20px 10px;
}
#stylized button{
clear:both;
margin-left:160px;
width:125px;
height:31px;
background:#444;
text-align:center;
line-height:31px;
color:#FFFFFF;
font-size:11px;
font-weight:bold;
border:solid 1px #000;
}
</style>
<form id="form1" id="form1" action="mail.php" method="POST">
<label>Name
<span class="small">Add your name</span>
</label>
<input type="text" name="name">
<label>Email
<span class="small">Enter a Valid Email</span>
</label>
<input type="text" name="email">
<label>Phone
<span class="small">Add a Phone Number</span>
</label>
<input type="text" name="phone">
<br />
<br />
<label>Business
<span class="small">Your Business</span>
</label>
<input type="text" name="business">
<label>Priority
<span class="small">Priority Level </span>
</label>
<select name="priority" size="1">
<option value="Low">Low</option>
<option value="Normal">Normal</option>
<option value="High">High</option>
<option value="Emergency">Emergency / 24 Hour Support</option>
</select>
<br />
<br />
<br />
<label>Type
<span class="small">Type of Contact</span>
</label>
<select name="type" size="1">
<option value="hardware">Hardware Service</option>
<option value="software">Software Service</option>
<option value="network">Network Service</option>
<option value="custom">Custom Builds</option>
</select>
<br />
<br />
<br />
<label>Message
<span class="small">Type Your Message</span>
</label>
<textarea name="message" rows="6" cols="25"></textarea><br />
<button type="submit" value="Send" style="margin-top:15px;">Submit</button>
<div class="spacer"></div>
</form>
</div> <!-- end of form class -->
PHP Code
- Code: Select all
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$business = $_POST['business'];
$priority = $_POST['priority'];
$type = $_POST['type'];
$message = $_POST['message'];
$formcontent=" From: $name \n Phone: $phone \n Business: $business \n Priority: $priority \n Type: $type \n Message: $message";
$recipient = "my.case.tech@gmail.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='contact.html' style='text-decoration:none;color:#ff0099;'> Return To Contact Form</a>";
?>
-
inspirilizationist
- New php-forum User

-
- Posts: 2
- Joined: Mon Oct 10, 2011 11:52 pm
by bbcompent1 » Fri Oct 21, 2011 3:23 am
Can you remove the die part so it shows what it isn't liking?
-
bbcompent1
- New php-forum User

-
- Posts: 3
- Joined: Fri Oct 21, 2011 3:11 am
Return to PHP coding => Mail
Who is online
Users browsing this forum: No registered users and 1 guest