Jump to content

destroy the value of a variable


ballhogjoni

Recommended Posts

If i am not mistaken I do.

 

my code

session_start(); 
include('db.php'); 
include('functions.php'); 
checkLogin('1 2');
$query = mysql_query("SELECT * FROM users WHERE ID = '{$_SESSION['user_id']}'");
$row = mysql_fetch_array($query) or die(mysql_error());
$Username = $row['Username'];
if (!empty($_POST['title'])) {
$title = $_POST['title'];
}
if (!empty($_POST['desc'])) {
$desc = $_POST['desc'];
}
if (!empty($_POST['price'])) {
$price = $_POST['price'];
}
if (isset($title)) {
$title_checked = strip_tags($title);
}
if (isset($desc)) {
$desc_checked = strip_tags($desc);
}
if (isset($title_checked) && isset($desc_checked) && isset($price)) {
if (!empty($title_checked) && !empty($desc_checked) && !empty($price)) {
	if (strlen($title_checked) > 20 || strlen($desc_checked) > 30) {
		$leng = '<span class="problemMessage">Please check the length of your Title and Description. Title is 20 Characters Max and Description is 30 Characters Max.</span>';
	} elseif (strlen($title_checked) <= 20 && strlen($desc_checked) <= 30) {
    		mysql_query("INSERT INTO products (Username, title, description, price) VALUES ('$Username','$title_checked','$desc_checked','$price')") or die(mysql_error());
		$verbage = '<span class="goodMessage">Your product has been saved.</span>';
		unset($title,$desc,$price);
	}
} else {
	$verbage = '<span class="problemMessage">Product has NOT been Saved. Please enable Javascript & be sure to fill in all fields</span>';
	unset($title,$desc,$price);
}
unset($title,$desc,$price);
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.