Hello
Below a simple order script. If the value is equal to zero there should not be a printing for this item. How? Which is the syntax?
<form action="test.php" method="post">
<input type="text" name="quantity1" value="0" onfocus="if(this.value=='0')this.value=''" size="5" /> item1</p>
<p>
<input type="text" name="quantity2" value="0" onfocus="if(this.value=='0')this.value=''" size="5" /> item2 </p>
<input type="submit" name="submit" value="send" />
php script:
<?php
$quantity1 = $POST['quantity1'];
$quantity2 = $POST['quantity2'];
print "you ordered $quantity1 item1 <br />";
print "you ordered $quantity2 item2";
?>
Example:If I fill out only quantity1 with the value 3 and quantity2 is left empty (value zero)the result should be:
you ordered 3 item1
Thanks