Store the input or response from users in local storage using an HTML table

After trying various methods, I have managed to implement a feature where users can input data into an HTML Table and save it using local storage. The goal is to allow users to easily retrieve their saved inputs when they revisit the page.

In addition, I am working on a section that displays the date with the ability to go back one day. For example, if the current date is April 22, I want to display April 21 along with the corresponding day, like Monday or Tuesday.

Here are some snippets of what I have implemented so far:

//For Local Storage
//var input = document.getElementById('daysFree').value;
//localStorage.setItem('daysFree', input);
//document.getElementById('daysFree').value = localStorage.getItem('daysFree'); //For getting the text back -->

// More similar code snippets...

//For Displaying the Date 
$(document).ready(function() {
  const monthNames = ["January", "February", "March", "April", "May", "June",
    "July", "August", "September", "October", "November", "December"
  ];
  
  // More JavaScript code...
});

Answer №1

Unfortunately, I missed the opportunity to comment on this earlier.

Utilizing JavaScript to store a user's input can be quite challenging. On the other hand, PHP, while complex, is relatively simpler in comparison.

To begin, it is essential to establish a new MySQL database. This involves having a proficiency in coding with MySQL.

Set up a new local server using saba on a Linux machine. You can learn how to do this by following this link> .

Establish the connection between the MySQL database and the server.

Enable PHP on the server.

Establish the PHP connection with the server.

In the samba file (www/html) on your Linux machine, create a new file named 'php.ini' and include file_uploads = on. This will facilitate PHP and user uploads.

Create a new PHP file named "connect-server.php". Here is an example code snippet you can use:
<?php
$servername = "localhost";
$username = "username";
$password = "password";

// Create connection
$conn = mysqli_connect($servername, $username, $password);

// Check connection
if (!$conn) {
  die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>

This script will establish the connection between PHP and the local server, enabling file uploads.

I may not provide every single line of code here, but if assistance is needed, refer to this resource >

https://www.w3schools.com/php/default.asp

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Utilizing AJAX and JavaScript to generate a table using the AJAX response and placing it within a <div> element

I am currently passing the response of this action in text form, but I would like to display it in a table format. Is there a way to do this? function loadAditivos(){ $('#aditivoAbertoInformacoesTexto').html('<div id="loaderMaior ...

Maintaining the current tabIndex while navigating between NextJS pages involves setting the tabIndex state in each

What is the best way to store and retrieve the current tabIndex when moving from one page to another? (One idea is to create a function that saves the current index in the sessionStorage and then retrieves it when the page loads) For example: https://i. ...

Converting HTML to plain text using the DOMDocument class

Is there a way to extract the text content from an HTML page source code, excluding the HTML tags? For example: <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="content-language" content="hu"/> <titl ...

Adapting the position of a table row in AngularJS based on the

I need assistance with creating a dynamic table-row that moves to indicate the current time in a table filled with timestamps. <table> <tr ng-repeat="timestamp in timestampArray"> <td>{{timestamp}}</td> </tr> ...

Creating a stunning HTML 5 panorama with GigaPixel resolution

Interested in creating a gigapixel panorama using HTML 5 and Javascript. I found inspiration from this example - Seeking advice on where to begin or any useful APIs to explore. Appreciate the help! ...

Transferring parameters via URL - When passing single quotes, they are converted to &#39;

In my current ASP.NET project, we encounter an issue with passing parameters through the URL. Whenever a single quote is passed, the URL automatically changes all single quotes to %27 and the actual JavaScript value reads them as &#39; I need assistan ...

You can activate the ability to click on the main tag by setting routerlink as the child component in Vue

Within my HTML code, I have utilized a RouterLink within an li tag to create a basic dropdown menu. Currently, when options are displayed in the dropdown menu, I am only able to click on the text itself to navigate to the next page. However, I would like t ...

Resolving Problems with setInterval in jQuery Ajax Calls on Chrome

Seeking assistance in returning the value of a specific URL periodically using jQuery and setInterval. Below is my current code snippet: $("form").submit(function() { setInterval(function(){ $('#upload_progress').load(&ap ...

Issue: Unable to bind function to expression

I'm struggling to understand why this plunker isn't functioning properly. The issue lies in my attempt to bind a basic function from a parent controller to a custom directive within a child element. Surprisingly, using = or < works fine, wher ...

Turn off all pointer events on the overlaying div but keep scrolling enabled

Issue: I am facing a problem with two containers that have overflowing text content like this: https://i.sstatic.net/wsasV.png In this setup, the blue <div>s have overflow:hidden applied. Now, I am trying to synchronize the scrolling behavior of th ...

Error occurred during Apple Login using Next_Auth: OAuthCallback issue

Attempting to log in with Apple using NextAuth. Authentication is successful, but it redirects to /?error=OAuthCallback. The URL being used is: https://appleid.apple.com/auth/authorize?client_id=com.wheeleasy.org&scope=name%20email&response_type= ...

Changing the formatting of a buffer from int8 to float32 using JavaScript

Within a buffer, I have a series of bytes that were read from a file. I am looking to convert these bytes into a sequence of float32 values without having to copy them to a new buffer, given that each data block is approximately 15KB in size. I have come a ...

My coding skills leave much to be desired and I am encountering some challenges with my current Hangman Game project

I recently started learning JavaScript and I'm encountering some difficulties with my code. My assignment is to create a hangman game, and I've successfully implemented the loops for displaying "right" and "wrong" letters. However, I'm strug ...

Children of flex items sharing the same height

I'm struggling with creating a flexbox responsive grid and need some guidance. My goal is to make all the .block divs have equal height, with the .bottom div positioned at the bottom. The current solution achieves this, but when the h2 heading spans ...

Can anyone help me with displaying auto complete HTML files in VScode?

As a Korean, please excuse my lack of proficiency in English. This image displays the autocomplete feature for HTML files in IntelliJ. This particular file was generated by Spring Boot (start.spring.io). How can I achieve the same in VSCode? ...

Detecting Specific Web Browsers on My Website: What's the Best Approach?

My website is experiencing compatibility issues with certain browsers, such as Firefox. I want to display a message when users visit the webpage using an unsupported browser, similar to how http://species-in-pieces.com shows a notification saying "Works ...

React JS functionality does not support Bootstrap tooltips

I'm attempting to implement a tooltip in my React app, but I'm experiencing issues with it not displaying properly. I am utilizing vanilla Bootstrap for this purpose. I've included the following script tag in my index.html file to import the ...

The path is visible, yet the ajax call does not make it through - it's simply "off course"

rake routes is used to verify the existence of a route: control1_route1 DELETE /control1/route1(.:format) However, when attempting to make a "delete" request to this route: var url = "<%= control1_route1_url %>"; $.ajax({url: url, type: "D ...

Building a custom shadowDOM with a dynamic bootstrap dropdown menu using JavaScript

As I work on developing a Chrome extension, I found myself in need of incorporating the split-button feature provided by Bootstrap within a shadow DOM. Despite my efforts, I have not been able to find clear guidelines on how to achieve this. Can anyone pro ...

I'm experimenting with incorporating images into a card component using the map function in JavaScript. All aspects of the card are functioning properly except for the image

import React from 'react' import Card from '@material-ui/core/Card'import CardMedia from '@material-ui/core/CardMedia'; import CardContent from '@material-ui/core/CardContent'; import {makeStyles} from '@materia ...