0

I am building a contact form, and I made it out of html and css, but I can't apply php to it in order to make it functional... I wanted it to have the abilities to notify me if someone submits form, the ability to only apply valid information, and etc.

I will place my html and css code if needed... i just need help applying the php part!

3
Contributors
8
Replies
11
Views
5 Years
Discussion Span
Last Post by <M/>
0

Sure, but remember its only css and html

Here is html

<div id="stylized" class="myform">
<form id="form" name="form" method="post" action="index.html">
<h1>Contact Us</h1>

<label>Name*</label>
<input type="text" name="name" id="name" />

<label> Email*</label>
<input type="text" name="email" id="email" />

<label>Comments
</label>
<input type="text" textarea name="comment" id="comment"></textarea>

<button type="submit">Sign-up</button>
<div class="spacer"></div>

</form>
</div>

Here is css

#stylized {
    position:absolute;
    z-index:1;
    left: 22px;
    top: 8px;
}

body{
font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
p, h1, form, button{border:0; margin:0; padding:0;}
.spacer{clear:both; height:1px;}
.myform{
margin:0 auto;
width:330px;
padding:14px;
height: 200px;
}
#stylized{
border:solid 1px #5c6063;
background: #EAEAEA;
}
#stylized h1 {
font-size:12px;
margin-bottom:8px;
}
#stylized label{
display:block;
text-align:left;
width:140px;
float:left;
left: 10px;
}
#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 #aacfe4;
width:200px;
margin:2px 0 20px -65px;
height: 20px;
}
#stylized button{
clear:both;
margin-left:150px;
width:125px;
height:31px;
background:#666666  no-repeat;
text-align:center;
line-height:31px;
color:#FFFFFF;
font-size:11px;
font-weight:bold;
}




.disclaimer {
    color: #CCC;
}
.disclaimer_dark {
    color: #666;
}

I'm not sure if I did everything properly, but all I'm looking forward to is a finished and active form, I know you can help :)

0

<form id="form" name="form" method="post" action="name_of_script.php">
<h1>Contact Us</h1>
<label>Name</label>
<input type="text" name="name" id="name" />
<label> Email
</label>
<input type="text" name="email" id="email" />
<label>Comments
</label>
<input type="text" textarea name="comment" id="comment"></textarea>
<button type="submit">Sign-up</button>
<div class="spacer"></div>
</form>

Very basic, but you should get the idea:

<?php

$to = '[YOUR_EMAIL_ADDRESS]';


//Clean data
$name = strip_tags(trim($_POST[name]));
$email = strip_tags(trim($_POST[email]));
$comment = strip_tags(trim($_POST[comment]));

////

$subject = "New form submitted";

$message = $name . "has submitted a form\n";
$message .= "Email address " . $email"\n";
$message .= "Comment: " . $comment;


mail($to,$subject,$message);


?>
0

Thanks for the help, I will try it out, and I will update you :)

0

Sorry for not updating you, I forgot to come back... but yes it worked but I'm planning on taking things a step further! so thanks for your assistance :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.