Using input type Checkbox and Text to display both the checked checkbox and text - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Sunday, March 27, 2022

Using input type Checkbox and Text to display both the checked checkbox and text

I am making a BMR calculator with fixed MET values, but I am also giving the user to pick activities. I am very new to PHP and HTML, but I want to display both checked checkbox and text, showing what activity they chose and how many hours they have done.

<h3><font color = "grey">Light Intensity Activites</font></h3>
        <p>1.<input type = "checkbox" name = "activites" value = 0.9/> Sleeping
            <input type = "number" name = "data[0][name]" min = 0> hour(s) </p>
            
        <p>2.<input type = "checkbox" name = "activites" value = 1.0/> Watching Television 
            <input type = "number" name = "1.2[]" min = 0> hour(s)</p>
            
        <p>3.<input type = "checkbox" name = "activites" value = 1.5/> Writing, Desk, Work 
            <input type = "number" name = "1.3[]" min = 0> hour(s)</p>
            
        <p>4.<input type = "checkbox" name = "activites" value = 2.3/> Walking/Strolling(2.7km/h) 
            <input type = "number" name = "1.4[]" min = 0> hour(s)</p>
            
        <p>5.<input type = "checkbox" name = "activites" value = 2.9/> Walking(4km/h) 
            <input type = "number" name = "1.5[]" min = 0> hour(s)</p>
    


    

Here I put the checkbox value as the metabolic equivalent value and the text as hours. And in PHP I want to display both the checked and text values when the form is submitted.



source https://stackoverflow.com/questions/71630875/using-input-type-checkbox-and-text-to-display-both-the-checked-checkbox-and-text

No comments:

Post a Comment