Copy link to clipboard
Copied
I'm a student and I need help! Does anyone have a basic code for a contact us internal page for my website! Would really save time! Please and thank you!!
Copy link to clipboard
Copied
<?php
// Name this file contact.php
// Be sure to change the value of $to to your own email address
// Be sure to name the file contact.php
// the next line only runs the processing script if the form has been submitted.
// the next line makes sure the email address is actually an email address
// The "!" at the beginning means do the following if the email address is NOT true. Remove the "!" and it would mean IF IS TRUE
if (!filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL)){
$message="Please provide a correct email address";} else {
// strip_tags is a PHP function that removes all tags from a block of text. For instance harmful script could be injected in the form fields by a hacker. strip_tags will remove such scripts.
$name = strip_tags($_POST['name']);
$company_name = strip_tags($_POST['company_name']);
$telephone = strip_tags($_POST['telephone']);
$email = $_POST['email'];
$comments = strip_tags($_POST['comments']);
$to = 'your@emailaddress.com';
$subject = 'Contact form submitted.';
$body = $name. "\n" .$comments;
$headers = 'From: ' .$email;
// This is the line that actually mails the form data. The PHP function is simply mail(). The function needs to know:
// who to send to
// what the subject line should be
// what the email should consist of
// headers can include various info, but in this case just includes the email address of the sender
// Note that if the email does not send, a message is returned to notify the user of the failure.
if (mail($to, $subject, $body, $headers)) {
echo 'Thanks for contacting us. We\'ll be in touch soon!';
} else {
$message = 'Sorry an error occurred. Please try again later.';
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<?php echo "<p style='color:red'>$message</p>"; ?>
<div class="contact_form">
<form id="contactform" action="contact.php" method="post">
<p>Name:<br/><input name="name" type="text" required /></p>
<p>Company Name: <br/><input name="company_name" type="text" required/></p>
<p>Telephone: <br/><input name="telephone" type="tel" required/></p>
<p>Email: <br/><input name="email" type="email" required/></p>
<p>Comments: <br/><textarea name="comments" required/> </textarea></p>
<input type="submit" name="submit" value="Send!"/>
</form>
</div>
</body>
</html>
Copy link to clipboard
Copied
Thank you so much! you have really helped me out!!
Copy link to clipboard
Copied
Could you by chance help me out again? So my page is done, however, It looks weird! I need the background purple, my top nav inside the white space, and my picture right next to my "Welcome to InVoke Studios" text. Here is my code! If you can help out, I promise to send you tons of positive vibes! Thank you for your help previously! The online community here is amazing! Here is my code!
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>InVoke Studios</title>
<style>
body {
font-family:Verdana, Geneva, sans-serif;
font-size: 14px;
line-height: 1.5em;
color: #333333;
}
#container {
height: 768px;
width: 1024px;
margin-right: auto;
margin-left: auto;
}
header {
font-family:Verdana, Geneva, sans-serif height: 125px;
width: 1024px;
background-color: #000;
color: #FFF;
}
#TitleBar {
height: 50px;
width: 1024px;
}
#Main {
height: 448px;
width: 1024px;
}
#Main #contentOne {
height: 448px;
width: 512px;
float: left;
}
#Main #ContentTwo {
height: 448px;
width: 512px;
float: right;
}
#innerMain {
background-color: #33C;
height: 376px;
width: 512px;
border-radius: 15px;
padding-top: 72px;
padding-left: 72px;
}
#TitleBar { background-color: #6FC; }
#TopNav {
height: 45px;
width: 1024px;
}
footer {
height: 100px;
width: 1024px;
}
footer #BottomNav {
height: 40px;
width: 1025px;
color: #FFF;
text-align: center;
display: block;
padding-top: 10px;
border-bottom-style: solid;
border-bottom-width: 2px;
}
h1 { font-family: "Comic Sans MS", cursive; }
h2 { margin: 0px; }
h1 { font-size: 4em; }
h2 { font-size: 1.5em; }
header {
padding: 35px 0 0 35px;
min-height: 95px;
width: 989px;
}
#TitleBar {
text-align: center;
height: 35px;
padding-top: 15px;
}
#TopNav a {
color: #F63;
text-decoration: none;
text-transform: uppercase;
font-weight: bold;
display: inline-block;
margin-right: 15px;
padding: 10px 0 0 15px;
width: 1009px;
height: 35px;
}
#TopNav a hover {border-bottom: 2px solid #F63;}
#TitleBar {background-color: #33C;}
#TitleBar h2 {color: #FFF;}
#BottomNav a {
margin-right: 15px;
}
</style>
</head>
<body>
<div id="container">
<header>
<h1>InVoke Studios</h1>
</header>
<div id="TitleBar">
<h2>Creative Minds +</h2>
</div>
<nav id="TopNav">
<p><a href="#">Home</a> <a href="https://www.youtube.com/channel/UCeloVM6iK0SHFLKhy8oUkuA">Youtube</a> <a href="#">Art</a> <a href="#">Podcast</a> <a href="file:///E|/Invoke Contact us.html">Contact Us</a></p>
</nav>
<div id="Main">
<div id="innerMain"></div>
<div id="contentOne">Content for id "contentOne" Goes Here <img src="InVoke Studios Website/Images/skyline_zpswb7kjlil.jpg" width="1024" height="495" alt="Cleveland"></div>
<div id="ContentTwo">
<div data-tower-id="1456935922904-0" data-automation-hook="row-pip">
<div data-automation-hook="title-pip" data-tower-id="1456935922904-0-0">
<h2 data-automation-hook="title">
<div>
<p><span data-color="#b31f28"><span data-color="#ee2143">Welcome ​To Our Studio</span></span></p>
</div>
</h2>
</div>
</div>
<div data-tower-id="1456935922904-1" data-automation-hook="row-pip">
<div data-automation-hook="paragraph-pip" data-tower-id="1456935922904-1-0">
<div>
<p>InVoke Studios is a space for creative minds to explore. Started as an idea around the kitchen table, founder Chad Smith found it frustrating that accessing a one-stop-shop for all things Media and Communication was nearly impossible to find. As a solution, him and his team strive to offer the best services themselves, as well as assisting clients in finding the outside resourcing they need, all in one place. With experience in Public Relations and Filmography and Photography, InVoke Studios provides pre- and post-production services such as planning and creating projects via film, photo, and writing, as well as editing. InVoke Studios also promotes and produces all the projects that clientele present. The InVoke Studios team prides itself on being a quality driven team, not a profit driven team. Whatever you need, InVoke Studios will deliver the quality and efficiency you need to make your vision come true!</p>
</div>
</div>
</div>
</div>
<!--/main--></div>
<footer>
<nav id="BottomNav"><a href="#">Terms of Service</a> <a href="#">Privacy Policy</a> <a href="#">Partners</a> <a href="#">Contact Number: 1-440-258-9704</a></nav>
</footer>
<!--/container--></div>
</body>
</html>