NickP Posted November 20, 2014 Share Posted November 20, 2014 (edited) Here's the code, this is the PHP in my html contacts page (that IS in fact saved with a PHP extension): <div class = "centercontainer"> <form method="post" action="NickParkerPhotoContact.php"> <label class = "labelwithmargin">Email: Nick@NickParkerPhoto.com</label> <label>Please use the form below:</label> <br> <label class = "labelwithmargin">Name*</label> <input name="name" placeholder="Type Here"> <label class = "labelwithmargin">Number</label> <input name="number" placeholder="Type Here"> <label class = "labelwithmargin">Email*</label> <input name="email" type="email" placeholder="Type Here"> <label class = "labelwithmargin">Message</label> <textarea name="message" placeholder="Type Here"></textarea> <input id="submit" name="submit" type="submit" value="Submit"> <?php if ($_POST['submit']) { $name = $_POST['name']; $number = $_POST['number']; $email = $_POST['email']; $message = $_POST['message']; $from = 'From: NickParkerPhoto website'; $to = 'NickParkerPhoto@gmail.com'; $subject = 'Message from website'; $body = "From: $name\n Number: $number\n E-Mail: $email\n Message:\n $message"; if (mail ($to, $subject, $body, $from))) { echo '<p>Your message has been sent!</p>'; } else { echo '<p>Something went wrong, go back and try again!</p>'; } } ?> </form> And the issue is I keep seeing this in my web page, which means my code is not working with the submit button I created.. :I'm a complete newby to PHP and have been learning it mostly just for this contact page, but learning that it is a server only-widely accepted language I'm pretty hyped to know anything about it... Thanks! Nick P. Edited November 20, 2014 by NickP Quote Link to comment https://forums.phpfreaks.com/topic/292584-issues-with-displaying-if-else-echo-statement-in-contact-page/ Share on other sites More sharing options...
mac_gyver Posted November 20, 2014 Share Posted November 20, 2014 what URL did you enter in your browser's address bar for that page? if you are doing this on a localhost development system, it should have been something like - http:/localhost/yourpage.php Quote Link to comment https://forums.phpfreaks.com/topic/292584-issues-with-displaying-if-else-echo-statement-in-contact-page/#findComment-1497052 Share on other sites More sharing options...
NickP Posted November 20, 2014 Author Share Posted November 20, 2014 Yup. Using xampp.. Quote Link to comment https://forums.phpfreaks.com/topic/292584-issues-with-displaying-if-else-echo-statement-in-contact-page/#findComment-1497053 Share on other sites More sharing options...
QuickOldCar Posted November 23, 2014 Share Posted November 23, 2014 Right off i see a mistake change this: if (mail ($to, $subject, $body, $from))) { to this: if (mail ($to, $subject, $body, $from)) { Besides that, obviously php is not parsing correctly, first make sure xampp is configured and working. Quote Link to comment https://forums.phpfreaks.com/topic/292584-issues-with-displaying-if-else-echo-statement-in-contact-page/#findComment-1497370 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.