好的,我的任务是编写一个简单的 php 票务系统。我不知道如何从称为年龄的输入中获取所有值
我的代码看起来像这样,我真的不知道从这里去哪里
<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 as $f)
{
echo "$f</br>";
}
}
}
?>