Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8877317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:26:23+00:00 2026-06-14T19:26:23+00:00

I want to store the values based on the check-box selected sequentially.but i have

  • 0

I want to store the values based on the check-box selected sequentially.but i have an error as undefined index : productadd and so on.

Designing part:

<table  width="600" style=" border-color:#799647; border-bottom-color:#799647; border-left-color:#799647; border-right-color:#799647; border-top-color:#799647;" border="2" >
    <tr style="border-color:#799647; background-color:#CAF9C5;">

        <td style="border-color:#799647;"><h4  style="color:Green;">Page Name</h4></td>
        <td style="border-color:#799647;"><h4  style="color:Green;">Add</h4></td>
        <td style="border-color:#799647;"><h4  style="color:Green;">Edit</h4></td>
        <td style="border-color:#799647;"><h4  style="color:Green;">View</h4></td>
        <td style="border-color:#799647;"><h4  style="color:Green;">Delete</h4></td>

        </tr>
        <tr style="border-color:#799647; background-color:#F5F2BF;">
        <td align="center"><label>Products</label><input type="checkbox" name="screen[]" value="Products Master" align="absmiddle" /></td>
        <td style="border-color:#799647;"><input type="checkbox" id="Productsadd" name="Productsadd" value="Yes" /></td>
        <td style="border-color:#799647;"><input type="checkbox" id="Productsedit" name="Productsedit" value="Yes" /></td>
        <td style="border-color:#799647;"><input type="checkbox" id="Productsview" name="Productsview" value="Yes" /></td>
        <td style="border-color:#799647;"><input type="checkbox" id="Productsdelete" name="Productsdelete" value="Yes" /></td> </tr>

        <tr style="border-color:#799647; background-color:#F5F2BF;">
        <td><label>SerialNO</label><input type="checkbox" name="screen[]" value="SerialNO" /></td>
        <td style="border-color:#799647;"><input type="checkbox" id="SerialNOadd" name="SerialNOadd" value="Yes" /></td>
        <td style="border-color:#799647;"><input type="checkbox" id="SerialNOedit" name="SerialNOedit" value="Yes" /></td>
        <td style="border-color:#799647;"><input type="checkbox" id="SerialNOview" name="SerialNOview" value="Yes" /></td>
        <td style="border-color:#799647;"><input type="checkbox" id="SerialNOdelete" name="SerialNOdelete" value="Yes" /></td> </tr>

        <tr style="border-color:#799647; background-color:#F5F2BF;">
        <td><label>Vechile Make</label><input type="checkbox" name="screen[]" value="Vechile Make" /></td>
        <td style="border-color:#799647;"><input type="checkbox" name="Vechileadd" value="Yes" /></td>
        <td style="border-color:#799647;"><input type="checkbox" name="Vechileedit" value="Yes" /></td>
         <td style="border-color:#799647;"><input type="checkbox" name="Vechileview" value="Yes" /></td>
        <td style="border-color:#799647;"><input type="checkbox" name="Vechiledelete" value="Yes" /></td> </tr>

        <tr style="border-color:#799647; background-color:#F5F2BF;">
        <td><label>Retailer</label><input type="checkbox" name="screen[]" value="Retailer" /></td>
        <td style="border-color:#799647;"><input type="checkbox" name="Retaileradd" value="Yes" /></td>
        <td style="border-color:#799647;"><input type="checkbox" name="Retaileredit" value="Yes" /></td>
        <td style="border-color:#799647;"><input type="checkbox" name="Retailerview" value="Yes" /></td>
        <td style="border-color:#799647;"><input type="checkbox" name="Retailerdelete" value="Yes" /></td> </tr>
 </table>

when i used to click the save button following codes are going to be executed .but i have a error in the switch case function .
Php code:

if(isset($_POST['Save']))
{
    $post['userid'] =($_POST['userid']);

    if(!empty($_POST['userid']))
     {  
    // if(is_array($_POST['Products'])) 
    // {
        foreach($_POST['screen'] as $post['Pagename'])
        {
        //  myfun($post['Pagename']);
switch($post['Pagename'])
    {
        case "Products Master": 
                                $post['addition'] =($_POST['Productsadd']);
                                $post['edit'] =($_POST['Productsedit']);
                                $post['vieww'] =($_POST['Productsview']);
                                $post['del'] =($_POST['Productsdelete']);
                                break;  

        case "SerialNO": 
                                $post['addition'] =($_POST['SerialNOadd']);
                                $post['edit'] =($_POST['SerialNOedit']);
                                $post['vieww'] =($_POST['SerialNOview']);
                                $post['del'] =($_POST['SerialNOdelete']);
                                break;  
        case "Vechile Make": 
                                $post['addition'] =($_POST['Vechileadd']);
                                $post['edit'] =($_POST['Vechileedit']);
                                $post['vieww'] =($_POST['Vechileview']);
                                $post['del'] =($_POST['Vechiledelete']);
                                break;  
        case "Retailer": 
                                $post['addition'] =($_POST['RetailerOadd']);
                                $post['edit'] =($_POST['Retaileredit']);
                                $post['vieww'] =($_POST['Retailerview']);
                                $post['del'] =($_POST['Retailerdelete']);
                                break;  

        default : 
                            ?>
                            <script type="text/javascript">
                            alert("Nothing selected.!!");document.location='userrights.php';
                            </script>
                                <?  

}
                    //echo $post['Pagename'];
        $news->addNews($post);
    //   }  
     }

        ?>
            <script type="text/javascript">
            alert("Created Sucessfully..!!");document.location='userrights.php';
            </script>
            <?
}
}
  ![this is my visual screen][1]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:26:25+00:00Added an answer on June 14, 2026 at 7:26 pm

    This will fix it, by checking if the index is set before accessing it.

    However, I suggest you look into using arrays instead for your checkboxes to group them into collections for easier parsing:

    if(isset($_POST['Save']))
    {
        $post['userid'] = isset($_POST['userid']) ? $_POST['userid'] : null;
    
        if(!empty($_POST['userid']))
         {  
        // if(is_array($_POST['Products'])) 
        // {
            foreach($_POST['screen'] as $post['Pagename'])
            {
            //  myfun($post['Pagename']);
    switch($post['Pagename'])
        {
            case "Products Master": 
                                    $post['addition'] = isset($_POST['Productsadd']) ? $_POST['Productsadd'] : null;
                                    $post['edit'] = isset($_POST['Productsedit']) ? $_POST['Productsedit'] : null;
                                    $post['vieww'] = isset($_POST['Productsview']) ? $_POST['Productsview'] : null;
                                    $post['del'] = isset($_POST['Productsdelete']) ? $_POST['Productsdelete'] : null;
                                    break;  
    
            case "SerialNO": 
                                    $post['addition'] = isset($_POST['SerialNOadd']) ? $_POST['SerialNOadd'] : null;
                                    $post['edit'] = isset($_POST['SerialNOedit']) ? $_POST['SerialNOedit'] : null;
                                    $post['vieww'] = isset($_POST['SerialNOview']) ? $_POST['SerialNOview'] : null;
                                    $post['del'] = isset($_POST['SerialNOdelete']) ? $_POST['SerialNOdelete'] : null;
                                    break;  
            case "Vechile Make": 
                                    $post['addition'] = isset($_POST['Vechileadd']) ? $_POST['Vechileadd'] : null;
                                    $post['edit'] = isset($_POST['Vechileedit']) ? $_POST['Vechileedit'] : null;
                                    $post['vieww'] = isset($_POST['Vechileview']) ? $_POST['Vechileview'] : null;
                                    $post['del'] = isset($_POST['Vechiledelete']) ? $_POST['Vechiledelete'] : null;
                                    break;  
            case "Retailer": 
                                    $post['addition'] = isset($_POST['RetailerOadd']) ? $_POST['RetailerOadd'] : null;
                                    $post['edit'] = isset($_POST['Retaileredit']) ? $_POST['Retaileredit'] : null;
                                    $post['vieww'] = isset($_POST['Retailerview']) ? $_POST['Retailerview'] : null;
                                    $post['del'] = isset($_POST['Retailerdelete']) ? $_POST['Retailerdelete'] : null;
                                    break;  
    
            default : 
                                ?>
                                <script type="text/javascript">
                                alert("Nothing selected.!!");document.location='userrights.php';
                                </script>
                                    <?  
    
    }
                        //echo $post['Pagename'];
            $news->addNews($post);
        //   }  
         }
    
            ?>
                <script type="text/javascript">
                alert("Created Sucessfully..!!");document.location='userrights.php';
                </script>
                <?
    }
    }
      ![this is my visual screen][1]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to store a set of values in delphi, but i want
I want to store values and retrieve them from a Java HashMap. This is
I want to store the average values of some data that is occasionally generated
I want to use ARC in my simple class where I store some values
i am using coredata in my application to store and retrieve values.i want to
I want to store some value from SQLite database in my buffer, but the
If I have a class with some value member that I want to store
I have a basic dataset stored in javascript that I want to filter based
I have store 111 million key-value pairs (one key can have multiple values -
I want to store the href value in a cookie, trouble is when i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.