i have code for valid some form and it's working fine
my code jop that is valid form then send message in the next page this is the full code
<?
$name=$_POST['name'];
$email=$_POST['email'];
$msg=$_POST['msg'];
if($_POST['submit']){
if(empty($name))
$errorname = ("<span id='error'>no name</span>");
if(empty($email))
$erroremail = ("<span id='error'>no email</span>");
if (empty($msg))
$errormsg = ("<span id='error'>no msg</span>");
else {
echo'<script>window.location = "process.php";</script>';
}
}
?>
<form dir="rtl" action="" method="post">
<div>name<span class="nothing"> </span><input type="text" name="name" id="name" dir="rtl">
<span id="errororg"> <?= $errorname; ?></span></div>
<div >email<span class="nothing"> </span><input type="email" color="#fff" name="email" id="email"><span id="errororg"> <?= $erroremail; ?></span></div>
<span>msg</span>
<div><textarea rows="10" name="msg" id="comment" dir="rtl"></textarea><span id="errororg"><?= $errormsg; ?></span></div>
<div><input type="submit" name="submit" value="send" dir="rtl"></div><br>
</form>
=======
so it's working fine and the valid message and every thing fine but the message arrived empty !
this is code of next page
<?
$name=$_POST['name'];
$email=$_POST['email'];
$msg=$_POST['msg'];
date_default_timezone_set('Asia/Baghdad');
$nw_date=date("F j, Y");
$body="name: ".$name."\n msg: ".$msg."\n date: ".$nw_date;
$email="$email";
mail("rezult.smtp@gmail.com", "new msg",$body, "from: <".$email.">");
echo "<span class='eco'>thanks for contact<br></span>";
echo "<span dir='rtl'>- </span>"."<a href='contact.php'>back..</a>";
?>
so i expect the problem of empty message is because
else {
echo'<script>window.location = "process.php";</script>';
so i removed it and put process.php in the action
<form dir="rtl" action="" method="post">
it's worked and the message arrived fine
but the validation didn't work
so how i can make the code and the validation executed before go to next page .. ?
i know how to do this by javascript
but can i do it in this code ? what i missed ?
thanks a lot .. and sorry for long question