i have contact.html page have form on. form action goes .php page handle email, nothing special. on page have:
<?php function check_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } $firstname = check_input($_request['firstname']); $lastname = check_input($_request['lastname']); $email = check_input($_request['email']); $phone = check_input($_request['phone']); $message = check_input($_request['message']); $human = check_input($_request['human']); $webpackage = check_input($_request['webpackage']); $webdesign = check_input($_request['webdesign']); $customdesign = check_input($_request['customdesign']); if ($human == 5) { $to = "****.com"; $subject = "from ****"; $body = " from: $firstname $lastname\n\n e-mail: $email\n\n phone: $phone\n\n message:\n\n $message\n\n web package:$webpackage\n\n web design:$webdesign\n\n custom design:$customdesign"; mail ($to, $subject, $body); header('location: index.html'); } else { $result="<div class=\"alert alert-danger\">sorry there error sending message. please go , check anti-spam answer</div>"; } ?>
i have simple box equals 5 checking value for. works , email sent info. but if not equal 5 problem starts. page goes action.php
page , blank.
my html on contact.html
page is:
<div class="form-group"> <div class="col-sm-10 col-sm-offset-2"> <?php echo($result); ?> </div> </div>
using action.php
page through form. else .html:
<form class="form-horizontal" id="contact-form" method="post" action="/action.php">
is there way this? have work around echo
error .php
page. works if !=5
not want do. may tell, not php literate.
you can set variable in $_session[]
array, , in "else" section use header()
redirect page display value stored.
see example in other answered question:
Comments
Post a Comment