javascript - calling php from aspx -
i have contact form in aspx page after clicking submit posts php page. see php not being called. when click submit no email sent or when fileds empty nothing happens. form in aspx file:
<form action="form-to-email.php" method="post"> <div class="contact-form margin-top"> <label> <span>full name</span> <input type="text" class="input_text" name="name" id="name" /> </label> <label> <span>email</span> <input type="text" class="input_text" name="email" id="email" /> </label> <label> <span>subject</span> <input type="text" class="input_text" name="subject" id="subject" /> </label> <label> <span>message</span> <textarea class="message" name="feedback" id="feedback"></textarea> <input type="submit" name="submit" id="submit" class="button" value="submit form" /> </label> </div> </form>
and php page:
<? if(!isset($_post['submit'])) { echo "error; need submit form!"; } $name = $_post['name']; $visitor_email = $_post['email']; $subject = $_post['subject']; $message = $_post['feedback']; if(empty($name)||empty($visitor_email)||empty($subject)||empty($message)) { echo "all fields mandatory!"; exit; } if(isinjected($visitor_email)) { echo "bad email value!"; exit; } $email_from='someone@gmail.com'; $email_subject=$subject; $email_body= "you have received message user $name .\n email address: $visitor_email\n here message:\n $message"; $to = 'someone@gmail.com'; $headers = "from: $email_from \r\n"; $headers .= "reply-to: $visitor_email \r\n"; mail($to,$email_subject,$email_body,$headers); function isinjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0a+)', '(%0d+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } ?>
i'm using visual studio btw.
Comments
Post a Comment