php - Get values of inputs with same name -


ok, have task write simple php ticket system. can't work out how values input called ages

my code looks , don't know go here

<form id="form" action="<?php echo $_server['php_self']; ?>" method="post">         <fieldset>             <label for="number">ticket count </label>             <input type="number" name="number" />             <input id="submit" type="submit" value="set ages" class="submit"/>              <?php                 $numberoftickets = $_post['number'];                 for($i=1;$i <=$numberoftickets;$i++){                     echo "<select class='ages' name='ages'>";                     echo "<option value='adult'>18 år och uppåt</option>";                     echo "<option value='youth'>13 – 18 år</option>";                     echo "<option value='child'>7 – 12 år</option>";                     echo "<option value='baby'>under 7  år</option>";                     echo "</select>";                 }             ?>          <input class="submit" type="submit" name="submit" value="beställ biljett" />         </fieldset>     </form>     </div><!--content-->     <?php         class ticket         {                      public function price($age)           {             return $price;           }           public function ages($ages)           {                 foreach($ages $f)                 {                     echo "$f</br>";                 }           }          }     ?> 

as <select> inside loop, assume there more 1 select named "ages". if case, this:

echo "<select class='ages' name='ages[]'>"; 

and values in php, use this:

$_post['ages'] 

that array. use for, foreach, implode or whatever need convert arrays text.

please explain more if not meant.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -