0
<?php
?> /*數組存儲天在一個星期*/ $ NoofDays =陣列(「星期一」,「星期二」,」週三」, 「Thurseday」, 「星期五」, 「星期六」, 「星期天」);保值已提交IIN PHP
?>
<div class="form-wrapper">
<form action="" method="post">
<select name="days">
<?php foreach($NoofDays as $days){?>
<option <?php if($daysTitle== '$days')?> selected="selected"> <?php echo $days;?></option>
<?php } ?>
</select>
<button type='submit' class="btn">Submit me</button>
</form>`enter code here`
</div>
<?php
/* Script to generate the Switch case */
if (isset($_POST['days'])) {
$selected = $_POST['days'];
switch ($selected) {
case "Monday":
echo "Laugh on Monday, Laugh for danger";
break;
case "Tuesday":
echo "Laugh on Tuesday, Laugh for stranger";
break;
case "Wednesday":
echo "Laugh on Wednesday,Laugh for Letter";
break;
case "Thurseday":
echo " Laugh on Thurseday,Something better";
break;
case "Friday":
echo "Laugh on Friday,Laugh for sorrow";
break;
case "Saturday":
echo "Laugh on Saturday,Joy Tommorow!";
break;
default:
echo "Laugh on Every day for some reason:)";
}
}
?>
它像一個魅力工作謝謝camel_case –