The following is an HTML form which is processed by the PHP code below. The intention is to determine which types of marketing the user is engaging in and issue recommendations accordingly, ie the PHP function will grow to more than the simple two recommendations seen below. My problem is being able to issue recommendations based off of which checkboxes have been selected. So if TV and Radio are selected, I want to issue this recommendation. If search and mobile are selected, I want to issue this recommendation. As is, all that echoes back is "You can do more to market your dealership" regardless of how many checkboxes I select. Any help would be greatly appreciated.
HTML FORM
<p>Marketing Mix:</p>
<input type="checkbox" name="TV" value="TV">TV<br>
<input type="checkbox" name="Radio" value="Radio">Radio<br>
<input type="checkbox" name="Search" value="Search">Search<br>
<input type="checkbox" name="Mobile" value="Mobile">Mobile<br>
<input type="checkbox" name="Mail" value="Mail">Direct Mail<br>
<br>
PHP
function marketMix () {
$tv = (isset($_POST['TV']));
$radio = (isset($_POST['Radio']));
$search = (isset($_POST['Search']));
$mobile = (isset($_POST['Mobile']));
$mail = (isset($_POST['Mail']));
if ($tv && $radio && $search && $mobile && $mail) {
echo "You are running a comprehensive ad campaign.";
} else {
echo "You can do more to market your dealership.";
}
}
Aucun commentaire:
Enregistrer un commentaire