sprinkles Posted August 22, 2006 Share Posted August 22, 2006 I have a form that's submitting all of the variables by post.I'm using this code to remove htmk/javascript and tocheck that they're not empty:$poster = $_POST['poster'];$cityid = $_POST['cityid'];$catid = $_POST['catid'];$subcatid = $_POST['subcatid'];$showphone = $_POST['showphone'];if($showphone=="on") {$showphone = 1;} else {$showphone = 0;}$title = $_POST['catid'];$title = strip_tags($title);$title = RemoveXSS($title);$body = $_POST['body'];$body = strip_tags($body);$body = RemoveXSS($body);$location = $_POST['location'];$location = strip_tags($location);$location = RemoveXSS($location);$price = $_POST['price'];$price = strip_tags($price);$price = RemoveXSS($price);$phone = $_POST['phone'];$phone = strip_tags($phone);$phone = RemoveXSS($phone);$email = $_POST['email'];$email = strip_tags($email);$email = RemoveXSS($email);if($cityid=="") {header("location: post.php?err=cityid");}if($catid=="") {header("location: post.php?err=catid");}if($title=="") {header("location: post.php?err=title");}if($body=="") {header("location: post.php?err=body");}if($location=="") {header("location: post.php?err=location");}if($phone=="") {header("location: post.php?err=phone");}if($email=="") {header("location: post.php?err=email");}Every time the script is run, it returns to the form with the blank email error. I've triple-checked the form field's name. EVen if I leave all of the other fields blank, it still goes back on the email. Anyone got any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/18331-checking-variables/ Share on other sites More sharing options...
Corona4456 Posted August 22, 2006 Share Posted August 22, 2006 Everything looks right the only thing I'm not sure about is the RemoveXSS function you are using. Try echoing the $email var after you set it to the $_POST['email'] and then after RemoveXSS just to make sure it's being set properly. You will need to comment out the "header("...")" code in order to see what the results are. Quote Link to comment https://forums.phpfreaks.com/topic/18331-checking-variables/#findComment-78777 Share on other sites More sharing options...
Barand Posted August 22, 2006 Share Posted August 22, 2006 Can't see anything other that missing exit(); statements after each of the header callsegif($cityid=="") {header("location: post.php?err=cityid");exit();} Quote Link to comment https://forums.phpfreaks.com/topic/18331-checking-variables/#findComment-78778 Share on other sites More sharing options...
wildteen88 Posted August 23, 2006 Share Posted August 23, 2006 Use if/elseif/else statement rather than seperate if statements. Quote Link to comment https://forums.phpfreaks.com/topic/18331-checking-variables/#findComment-79107 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.