Form Problems


How do you create a form in PHP where the results entered in from the user will be generated in a table?
When I test the pages, I only get the start of the table, key and results(values) fields but no values! Here is my code:

Order form-

Order Page

Order Page

<?php foreach ($_POST as $key => $entry) { $totalfields++; echo "\n"; echo "" . $key . ""; if(is_array ($entry)) { $count = count($entry); echo ""; for ($i=0; $i<$count; $i++) { echo $entry[$i] . "
"; } echo ""; } else { echo "$entry"; } echo "\n"; } ?> First Name:

    <label for="lname">Last Name:</label>
    <input type="text" name="lname" id="lname"/><br/>
    <label for="residence">Address:</label>
    <input type="text" name="residence" id="residence"/><br/>
    <label for="Citie">City:</label>
    <input type="text" name="citie" id="citie"/>
    <label for="state">State:</label>
      <select name= "state" id="state">
    <label for="zip">Zip:</label>
    <input type="text" name="zip" id="zip"/>
    <label for="products">Product 1:</label>
    <input type="checkbox" name="product_1" id="products"/><br/>
    <label for="products">Product 2:</label>
    <input type="checkbox" name="product_2" id="products"/><br/>
    <label for="products">Product 3:</label>
    <input type="checkbox" name="product_3" id="products"/><br/>
    <label for="products">Product 4:</label>
    <input type="checkbox" name="product_4" id="products"/><br/>

    <p><input type="submit" value="Submit"/></p>

Results form-

Results form
Field Results

lots of tutorials out there on MySQL select queries.

Sponsor our Newsletter | Privacy Policy | Terms of Service