I opened a new thread about the warning, because it seems to have nothing to do with adding lines to the database.
This is how far I have gotten:
This code placed right behind the size drop down menu will echo "make a selection" when I try to add a $0 item to the cart, but it does not prevent the item from being added to the cart.
<span class="validation">
<?php
if ($row_rspricelookup['price'] == "0")
{
echo"<--", " ", ($row_rscontent3['description5']);
}
?>
</span>
With this code I successfully call a javascript function, when I hit submit (shortened for better viewing):
form action="Action" method="post" name="Name" id="ID" onsubmit="return checkForm();">
And this is the javascript function:
<script type="text/javascript">
function checkForm()
{
var prize = ($row_rspricelookup['price']);
if (prize == "0")
{
alert("Check size selection");
return false;
}
}
</script>
Not working. However when I leave out the variable and the if condition, the alert box will pop up instead of the page submitting. So I know, that the function is properly called, just the condition/variable is wrong.
I want to compare the current price to "0", but don't know how to incorporate the database value into the javascript function. ($row_rspricelookup['price']) worked for the php code, but not for the javascript.
Jason, could you tell me, how to call the value?