Jump to content

Checking variables


sprinkles

Recommended Posts

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?
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.