Jump to content

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);
}
?>

Please explain in more detail what "It doesn't work" means.

 

As halofreek said, unset() does NOT work across refreshes (the exception being session variables).  If you explain what you want to do, then we can suggest an alternative.

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.