I have a form that submit values to a db via post method. I made a confirm box to pop up when the values are out of range of what is expected, the thing is that it's not working properly.
The php & javascript:
- Code: Select all
<?php
...
$dont_run = "true";
if($_soldfor < $_boughtfor || $_soldfor < $existing_cost){
?>
<script type="text/javascript">
<!--
var nP = confirm("You are seling a product for less than you bought! are you sure you want to make this sale?")
if(nP){
<?php $dont_run = false;
$message = "<b class='negative_msg'>you sold an item for less than you bought!</b>";?>
}else{
<?php $message = "<b class='negative_msg'>Sale cancelled!</b>";
$dont_run = true; ?>
}
//-->
</script>
<?php
}
if( $dont_run == false){
$insert_raw = new Product();
...
?>
Any help will be appreciated,
Mike


