I have created an HTML form which asks the user what types of marketing they are using. Depending on their answers, I intend to build a PHP recommender system based on those variations. I have started with a base function but it keeps returning the same echo statement regardless if I select none of the checkboxes or all of them. Here is the HTML code.
<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>
And here is the PHP function to process the HTML form.
function adMix () {
$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.";
}
}
Any help would be greatly appreciated. I've tried coding this six ways to Sunday but it's been a while since I wrote in PHP and just can't figure it out.
Aucun commentaire:
Enregistrer un commentaire