Hi, I have a basic question but it has me stumped. My client has a complicated order form with notes about products and different shipping rates for items. I'd like to avoid using a database catalog and make a print-friendly recipt after submitting a form. What is the best way to hide form rows that weren't choosen?

For example, the form looks like this:

<tr>
<td><input type="text" name="num_book_eng" value="" size="4" onchange="calc_book('eng', 'single')" /></td>
<td>$23.00</td>
<td><strong><em>The Comfort of Home - An Illustrated Step by Step Guide for Caregivers </em></strong></td>
</tr>

After they click submit, I'd like to hide rows that had a "0" value.

<tr class="<?= (empty($_GET['num_book_eng']))? "hidden": "show"; ?>">

That hides all rows the first time visiting the catalog form. Any sugestions would be appreciated!

-Nick

    I am assuming that the method on your form is get since I noticed that you are trying to test a value with $GET. With this being the case the value will be empty until the submit button is pressed. Remember that PHP is a server side language and as such until the submit button is pressed and the form actually submitted to the server it has no clue what the value of $GET[num_book_eng'] is. Maybe using javascript would help you in this matter.

      Using $GET[] should keep from having to also check isset($GET['submit']).
      How would you code 'if the form is submitted and this variable is "0", hide the row?'

      I found this link helpful on type comparisons helpful. Looks like the best way is

      <?= (isset($_GET['num_book_eng']) && empty($_GET['num_book_eng']))? "hidden":"";?>

      Thanks for your reply...

        Write a Reply...