In my JSX file, I have 4 icons all with a default color of gray.
In my MySQL Table, the Column “signal” has a value of either empty, 1, 2, 3, or 4.
This is what I’m looking for:
- When icon 1 is pressed, the icon would turn red, and the Column “signal” in the MySQL Table would be assigned a value of 1. If icon 1 is pressed again, the icon would turn back to gray, and the value in the MySQL Table would be assigned back to none.
- When icon 2 is pressed, the icon would turn amber, and the Column “signal” in the MySQL Table would be assigned a value of 2. If icon 2 is pressed again, the icon would turn back to gray, and the value in the MySQL Table would be assigned back to none.
- When icon 3 is pressed, the icon would turn green, and the Column “signal” in the MySQL Table would be assigned a value of 3. If icon 3 is pressed again, the icon would turn back to gray, and the value in the MySQL Table would be assigned back to none.
- When icon 4 is pressed, the icon would turn green, and the Column “signal” in the MySQL Table would be assigned a value of 4. If icon 4 is pressed again, the icon would turn back to gray, and the value in the MySQL Table would be assigned back to none.
Can anyone provide a sample code on how this could be done?