Jump to content

Recommended Posts

Hi, i have a 6 checkboxes which is supposed to call out a value from database. What i have in my database table is PreferRed, PreferWhite, PreferSparkling, PreferFortified and Email.

 

The value for the PreferA-PreferD is either YES or NO. So I have a checkbox with 6 values (All, Red, White, Fortified, Sparkling, NoPreference).

 

I need to know if Red-Sparkling is selected, and if yes, i need to call out the email of the user. And if All is selected, i need to filter it down from the database and same for NoPreference.

 

I have a code but cant seem to be working. Does anyone know what wrong with the code? The code is just part of it. Tell me if im on the right track. Thanks!

 

<?php
$User=$_POST['User'];
foreach ($User as $UserEmail)
{
echo "$UserEmail is checked<br>";
}
if($UserEmail = All){
echo "SQL FOR ALL";
}
elseif($UserEmail = Red){
{
echo "SQL FOR Red"
}
elseif($UserEmail = White){
echo "SQL FOR White";
}
elseif($UserEmail = Fortified){
echo "SQL FOR Fortified";
}
elseif($UserEmail = Sparkling){
echo "SQL FOR Sparkling";
}
else {
echo "SQL FOR NO PREFERENCE";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/191146-checkbox-to-select-user-from-db/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.