Not sure how to do this
Posted: Tue May 03, 2011 7:08 pm
Basically I have these two divs, one is the default but if the person enters the correct discount it should be hidden and the other one displayed, if they enter the wrong code it should leave the default and display "wrong code" I know this is not secure, but it is not important for this. Obviously, I am not a coder
.
Code: Select all
<?php
$discount = "rain15";
if ($_POST['txtdiscount'] != $discount) {
?>
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p><label for="txtdiscount" style="color:red">Discount Code:</label>
<input type="discount" title="Enter Discount Code" name="txtdiscount" />
</p>
</form>
<?php
}
$('#div1').css({'display' : 'block'});
$('#div2').css({'display' : 'none'});
else {
echo "wrong code";
?>
<?php
}
?>
<div id="div1" style="display:none">Content to show is discount is correct</div>
<div id="div2" style="display:block">Content that is hidden if discount is correct</div>