I am trying to set a variable value if a form is not submitted (where the value comes from). Below I have:
if (empty($order)) {
$order = 'ORDER BY product_name DESC';
}
else { $order=$_POST['order']; }
This always sets the value to 'ORDER BY product_name DESC' and ignores the form. Likely just a small issue but I can't pick it out.
Any ideas?
Thank you!
$orderis clearly always empty. Are you sure it is being set before you try to use it? Aslo, your code is insecure as it is wide open to sql injections.