dflow Posted March 16, 2011 Share Posted March 16, 2011 this works <form action="" method="post"> <input name="DepartureDate" type="text"> <input name="" type="submit"></form> <?php $DepartureDate=$_POST['DepartureDate']; echo $DepartureDate = stripslashes($DepartureDate); // sql inject clean $regex = "/^[a-z]+$/"; if (!preg_match($regex, $DepartureDate)){ echo 'CAPS BABY!';} else {echo 'OK!';} ?> this doesnt if (!preg_match($regex, $DepartureDate)) { mail($to, $subject, $message, $headers); echo $url_success = "confirmation.php"; //echo("<meta http-equiv = refresh content=0;url=".$url_success.">"); } else { exit(); } Quote Link to comment https://forums.phpfreaks.com/topic/230809-weird-need-help/ Share on other sites More sharing options...
Psycho Posted March 16, 2011 Share Posted March 16, 2011 What do you mean it doesn't work? You need to state what you expect to happen and what is, or is not, happening. Normally I would also state you need to state what the input is that you are testing against. But, in this case, I'm pretty sure your problem is on this line echo $url_success = "confirmation.php"; What are you trying to do on this line? Do you want to echo something or do you want to set a value? Quote Link to comment https://forums.phpfreaks.com/topic/230809-weird-need-help/#findComment-1188188 Share on other sites More sharing options...
dflow Posted March 16, 2011 Author Share Posted March 16, 2011 What do you mean it doesn't work? You need to state what you expect to happen and what is, or is not, happening. Normally I would also state you need to state what the input is that you are testing against. But, in this case, I'm pretty sure your problem is on this line echo $url_success = "confirmation.php"; What are you trying to do on this line? Do you want to echo something or do you want to set a value? the echo on this line was for test purposes, in any case i dont want capital letters in the departuredate field, but it still is sent despite the fact i inject "WeriUY" gibrish in the the date field Quote Link to comment https://forums.phpfreaks.com/topic/230809-weird-need-help/#findComment-1188249 Share on other sites More sharing options...
Psycho Posted March 16, 2011 Share Posted March 16, 2011 //Look for ANY character that is not lower case alpha character $regex = "/[^a-z]/"; if (!preg_match($regex, $DepartureDate)) { //All characters are lower case alpha caracters mail($to, $subject, $message, $headers); header("Location: {$url_success}"); } exit(); Quote Link to comment https://forums.phpfreaks.com/topic/230809-weird-need-help/#findComment-1188300 Share on other sites More sharing options...
dflow Posted March 16, 2011 Author Share Posted March 16, 2011 //Look for ANY character that is not lower case alpha character $regex = "/[^a-z]/"; if (!preg_match($regex, $DepartureDate)) { //All characters are lower case alpha caracters mail($to, $subject, $message, $headers); header("Location: {$url_success}"); } exit(); dont know why but this is not working Quote Link to comment https://forums.phpfreaks.com/topic/230809-weird-need-help/#findComment-1188343 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.