html - How will I write php code for this code? -
i'm struggling little create php html code. i'm more of front end designer end help? here have should basic yet have tried myself work seem make worse each time...
html code
<form action="form.php" method="post" enctype="multipart/form-data"> <label></label> <input name="name" required placeholder="your name"> <label></label> <input name="email" type="email" required placeholder="your email"> <label></label> <input name="tel" type="tel" placeholder="your contact number"> <label></label> <select name="treatment"> <option value="">select...</option> <option value="">anti-wrinkle injections</option> <option value="">dermal fillers</option> <option value="">the vampire facelift</option> <option value="">other treatments</option> </select> <label></label> <textarea name="message" cols="20" rows="5" required placeholder="message"></textarea> <input id="submit" name="submit" type="submit" value="submit"> </form> php code
<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: website'; $to = 'email'; $subject = 'email inquiry'; $body = "from: {$name}\n e-mail: {$email}\n message:\n {$message}"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>thank email! redirected home page.</p>'; } else { echo '<p>oops! error occurred. try sending message again.</p>'; } } ?>
this php should be:
<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: website'; $to = 'an email address'; $subject = 'email inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message";?> its ? not / @ end
i tested code, using php, , works correctly.
Comments
Post a Comment