An echo is not required because you are already telling him to add the result of the if statement to the $ result variable, using .to combine them.
To save the value, $resultyou just need an echo value as the input value of the form to submit:
<input type='hidden' name='result' value='<?php echo $result?>'>
In addition, this line:
<?php $result .= '<td>' .'<input type="text" value="'.(isset($_POST['quantity']) ? $_POST['quantity'] : '').' " name="quantity" />'.'</td></tr>';?>
Change to this:
<?php $result .= '<td>' .'<input type="text" value="'.((isset($_POST['quantity'])) ? $_POST['quantity'] : '').' " name="quantity" />'.'</td></tr>';?>
The entire if statement must be enclosed in quotation marks for proper operation.
source
share