PHP Contact Form Advice -
i have built contact page website, , when test out, thing appears message. there no contact information, except url of hosting site. advice on how fix appreciated. thank you.
here html code:
<form action="contact.php" class="form-style-9" method="post"> <ul> <li> <input type="text" name="first_name" class="field-style field-split align-left" placeholder="first name" /> <input type="text" name="last_name" class="field-style field-split align-right" placeholder="last name" /> </li> <li> <input type="text" name="phone" class="field-style field-split align-left" placeholder="phone" /> <input type="email" name="email" class="field-style field-split align-right" placeholder="email" /> </li> <li> <input type="text" name="subject" class="field-style field-full align-none" placeholder="subject" /> </li> <li> <textarea name="message" class="field-style" placeholder="message"></textarea> </li> <li> <input type="submit" value="send message" /> </li> </ul> </form>
and here php code:
<?php $first_name = $_post['first_name']; $last_name = $_post['last_name']; $phone = $_post['phone']; $email = $_post['email']; $subject = $_post['subject']; $message = $_post['message']; $to = "kyle@kylenarovich.com"; $subject = "new message"; mail ($to, $subject, $message, "from: " . $first_name . $last_name); echo "thank contacting me. in touch soon."; ?>
again, advice , appreciated, site live , if contacts me, have no way them if don't put there info in message.
thank much!!
<?php if($_server['request_method']=='post' && array_key_exists( 'form_submitted',$_post )){ $first_name = $_post['first_name']; $last_name = $_post['last_name']; $phone = $_post['phone']; $email = $_post['email']; $subject = $_post['subject']; $message = $_post['message']; $to = "kyle@kylenarovich.com"; $subject = "new message"; $res=@mail ($to, $subject, $message, "from: " . $first_name . $last_name); } ?> <html> <head> <title></title> </head> <body> <form action="contact.php" class="form-style-9" method="post"> <ul> <li> <input type="text" name="first_name" class="field-style field-split align-left" placeholder="first name" /> <input type="text" name="last_name" class="field-style field-split align-right" placeholder="last name" /> </li> <li> <input type="text" name="phone" class="field-style field-split align-left" placeholder="phone" /> <input type="email" name="email" class="field-style field-split align-right" placeholder="email" /> </li> <li> <input type="text" name="subject" class="field-style field-full align-none" placeholder="subject" /> </li> <li> <textarea name="message" class="field-style" placeholder="message"></textarea> </li> <li> <input type="submit" value="send message" /> <input type='hidden' name='form_submitted' value='true' /> </li> </ul> <?php if( $_server['request_method']=='post' && array_key_exists( 'form_submitted',$_post ) ){ if( $res==true ) echo 'thanks submitting form... etc etc'; else echo 'oops! failed send email'; } ?> </form> </body> </html>
Comments
Post a Comment