Note that there are some explanatory texts on larger screens.

plurals
  1. POSending form with a large amount of values in PHP
    primarykey
    data
    text
    <p>I am developing in a form in which people can order a catering service done by a tray system(ordering foods by try size, medium and large) and I'm having trouble on figuring out on how to do this. My first idea was to code it like this:</p> <pre><code>&lt;form id="tray" name="tray" method="post" action="send_mail_tray.php" onsubmit='return packageValidator()'&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;Pork Fried Rice&lt;/td&gt; &lt;td&gt; Med.:&lt;br /&gt; Lg. : &lt;/td&gt; &lt;td&gt; &lt;input type="text" name="PorkFriedRiceMed" style="width: 20px; height: 15px" /&gt;&lt;br /&gt; &lt;input type="text" name="PorkFriedRiceLg" style="width: 20px; height: 15px" /&gt; &lt;/td&gt; &lt;td&gt;Vegetable Spring Rolls&lt;/td&gt; &lt;td&gt; Med.:&lt;br /&gt; Lg. : &lt;/td&gt; &lt;td&gt; &lt;input type="text" name="VegetableSpringRollsMed" style="width: 20px; height: 15px" /&gt;&lt;br /&gt; &lt;input type="text" name="VegetableSpringRollsLg" style="width: 20px; height: 15px" /&gt; &lt;/td&gt; &lt;td&gt;Beef w/ Broccoli&lt;/td&gt; &lt;td&gt; Med.:&lt;br /&gt; Lg. : &lt;/td&gt; &lt;td&gt; &lt;input type="text" name="Beefw/BroccoliMed" style="width: 20px; height: 15px" /&gt;&lt;br /&gt; &lt;input type="text" name="Beefw/BroccoliLg" style="width: 20px; height: 15px" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;input type="Submit" value="Submit" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>With this method, I would have to be able to post the variable name along with the value. At first I thought this would have been the best method, however, after thinking about it, the list of foods being offered is over 150 which means I would have to create over 300 $_POSTs to get the entire menu and the e-mail I would be sending would have to contain all the items on the list, even if they were not ordered. Is there an easier way to go about making the form I'm doing or is my first method the best way?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload