Jump to content

1inaMinion

New Members
  • Posts

    1
  • Joined

  • Last visited

1inaMinion's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am new to this. So far, all I've learned for PHP covered mostly the contact form (My notes: http://www.carrotsails.com/notes/phpMaster.html) I created a nice contact form here: http://carrotsails.com/Resume/php/contactForm.php All is great to this point and I'm so proud of myself for making it this far. Then, I make my website portfolio, and as soon as I upload it, everything changes. There is part of my php sitting at the top where it doesn't belong. It appears the $results are displaying above my webpage and they aren't supposed to even show unless prompted and furthermore, not there. Although there are some other details with the website I also need to address, if the trouble I'm seeing here is php related, I need some help with it. Here is the website for your viewing: http://carrotsails.com/ Here is the code below. Thank you for your help. <?php if ($_POST["submit"]) { if (!$_POST['name']) { $error="</br>Please enter your name"; } if (!$_POST['email']) { $error.="</br>Please enter your email address"; } if (!$_POST['comment']) { $error.="</br>Please enter a comment"; } if ($_POST['email']!="" AND !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $error.="</br>Please enter a valid email address"; } if ($error) { $result='<div class="alert alert-danger"><strong>There were error(s) in your form:</strong> ' .$error.'</div>'; } else { if (mail("carrotsails@yahoo.com", "Comment from carrotsails.com!", "Name: ".$_POST['name']." Email: ".$_POST['email']." Comment: ".$_POST['comment'])) { $result='<div class="alert alert-success"><strong>Thank you I\'ll be in touch.</strong></div>'; } else { $result='<div class="alert alert-danger"><strong>Sorry, there was an error sending your message. Please try again later.</strong></div>'; } } } ?> <!doctype html> <html lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>Erika's Test Portfolio</title> <link rel="stylesheet" type="text/css" media="all" href="css/global01.css"> <link rel="stylesheet" type="text/css" media="all" href="http://fonts.googleapis.com/css?family=ABeeZee"> <!-- LIGHTBOX GALLERY STYLES --> <link rel="stylesheet" type="text/css" href="css/lightboxGalleryStyles.css"> <!-- MY STYLES --> <link rel="stylesheet" type="text/css" href="css/CarrotStyles.css"> <style type="text/css"> </style> </head> <body> <div id="about"> <div id="home"><div><!-- Deleted content for simplicity --></div></div> <div id="MeetErika"> <h2>Meet Erika</h2> <!-- Deleted content for simplicity --> </div> <div id="MyPortfolio"> <h2>The Portfolio</h2> <!-- Deleted content for simplicity --> </div> <div id="Contact"> <h2>Contact Erika</h2> <p>Please get in touch - I'll get back to you as soon as I can.</p> <?php echo $result; ?> <form method="post"> <div class="form-group"> <label for="name">Your Name:</label> <input type="text" name="name" class="form-control" placeholder="Your Name" value="<?php echo $_POST['name']; ?>"/> </div> <div class="form-group"> <label for="email">Your Email:</label> <input type="email" name="email" class="form-control" placeholder="Your Email" value="<?php echo $_POST['email']; ?>"/> </div> <div class="form-group"> <label for="comment">Your Comments:</label> <textarea class="form-control" name="comment" placeholder="Your Comments"><?php echo $_POST['comment']; ?></textarea> </div> <input type="submit" name="submit" class="btn" value="Submit" /> </form> </div> </div> <div id="mainpage"> <nav> <div><img src="images/ErikaFlowerLogo01.png" class="flower"/></div> <h1>Erika's Portfolio</h1> <ul id="navigation"> <li><a href="#home">Home</a></li> <li><a href="#MeetErika">Meet Erika</a></li> <li><a href="#MyPortfolio">Portfolio</a></li> <li><a href="#Contact">Contact</a></li> </ul> </nav> <div id="content"></div> </div> <!-- LIGHTBOX JAVASCRIPT LINK --> <script type="text/javascript" src="js/lightboxGalleryJs.js"></script> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.