Attempting to save user input via HTML form and then refer back to it later

General Tech Learning Aids/Tools 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Learning Aids/Tools related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I am currently in the process of designing a Computer Ahref="https://forum.tuteehub.com/tag/id">ided Learning package. The welcome screen simply requires the user to type in their name into a href="https://forum.tuteehub.com/tag/text">text href="https://forum.tuteehub.com/tag/field">field and click a button which directs them to 'subject selection' page. How would I go about storing the user input and how, if possible, could I refer to the stored value on a seperate html page?

 href="https://forum.tuteehub.com/tag/id">id="inputbox">
  
type="href="https://forum.tuteehub.com/tag/text">text" name="href="https://forum.tuteehub.com/tag/field">field" class="href="https://forum.tuteehub.com/tag/text">textInput" />
href="https://forum.tuteehub.com/tag/id">id="introsubmit"> href="newhref="https://forum.tuteehub.com/tag/game">game.html" title="New Game" href="https://forum.tuteehub.com/tag/id">id="introsubmit">
profilepic.png
manpreet 2 years ago

HTML:

<div id="inputbox">
  <form action="script.php">
      type="text" name="field" class="textInput" />
  form>
div>
<div id="introsubmit">
     href="newgame.html" title="New Game" id="introsubmit">
div>

That will send the form to script.php (if no 'action' defined, it will send the form to the very same page, if that html is inside script.php then it will work the same, and if no "method" is defined, if will use GET, you can set <form action="script.php" method="POST"> to change this):

script.php:

php
session_start();

$_SESSION['name'] = $_GET['name'];
?>

and then you reuse that variable in the same session, remember to always invoke session_start()before any output in your php.


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Important General Tech Links