Search the Community
Showing results for tags 'n00b'.
-
DISCLAIMER: this is my first time on this site, and I am a very beginning programmer still in high school, so please bear with any mistakes I might make. (if you have ANY advice or comments, feel free to share them with me, any help is appreciated) I am basically looking to make a series of css checkboxes (I only have one right now for testing purposes), which will submit onclick and store the value in a txt file. Upon loading, it will read that text document and set the checkbox default to what it was before. I could use the PHP session method, but I would like the default to carry on through reboots, etc. Currently, the file current.txt has a 1 in it, but the checkbox is still off. When I click the checkbox, it refreshes, but then goes back to off. any advice? <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <body> <form action="index3.php" method="post"> <div class="onoffswitch"> <?php //writing to the file with the results of POST $my_filew = 'current.txt'; $handlew = fopen($my_filew, 'w'); if (isset($_POST["onoffswitch1"]) && $_POST["onoffswitch1"] == "on") { fwrite($handlew,'1'); fclose($handlew); } if (isset($_POST["onoffswitch1"]) && $_POST["onoffswitch1"] == "0ff") { echo "hello"; fwrite($handlew,'0'); fclose($handlew); } //reading from the file and setting the default $my_filer = 'current.txt'; $handler = fopen($my_filer, 'r'); $datar = fread($handler,filesize($my_filer)); fclose($handler); if ($data == 1) { $checked="checked"; } else { $checked=""; } //outputting the html $option='onclick="setTimeout(function() {submit();},1250);"'; echo '<input type="checkbox" name="onoffswitch1" class=onoffswitch-checkbox" id="myonoffswitch" '.$checked.' '.$option.'>'; echo "\n"; ?> <label class="onoffswitch-label" for="myonoffswitch"> <div class="onoffswitch-inner"> <div class="onoffswitch-active"><div class="onoffswitch-switch">ON</div></div> <div class="onoffswitch-inactive"><div class="onoffswitch-switch">OFF</div></div> </div> </label> </div> </form> </body> </html>
-
Hi peeps, Im Scott, from Scotland.... ock aye the noo (before anyone else says it), Just thought i would introduce myself to the community and make some new friends along the way hopefully. I play guitar, sing, was on Xfactor 2010 (didnt get through though) i like Dr WHO and like a true Scotsman i can drink alot and handle my Whiskey.... Although my day-2-day jobs have always been in retail i have been a secret programmer all my life, hence i am here today i would like to meet fellow programmers, share ideas, share support and show of my projects and pimp myself for work. Recently being made redundant TWICE during covid i have decided to go out on my own and sell my programming skills and build projects/applications for other people. Over the years i have used lots of platforms starting out back in the day with SkyPortal an ASP CMS before WordPress days, since then i have been hooked on building addons, plugins, modules, applications whatever you want to call them. I was just sick of always being let down with free downloaded "addons", they either didnt do EVERYTHING i wanted it to OR you had to pay too much to unlock the feature you need or they bombarded my applications with advertising so since then if i needed a tool, i programmed it myself to get the job done! Ive been told i have a unique way of looking at problems and being able to resolve them with code and automation i suppose im a problem solver as well as a developer/inventor/programmer Ive just setup my own project website and want to build up a portfolio of scripts, plugins, applications and really ive joined this community today to share these, get valuable feedback, input and suggestions and meet like minded people to share ideas and support.