Basically, what I want to do is to have the rep/user enter their name on the first page they see, and it would insert their entered name into the script(s) depending on which PHP page they have selected from the side-menu. It was mentioned to use a $_SESSION variable...but I'm a bit confused on this as would it then require passing the variable from a php to a php first so that it can be called? Currently my pages are as such:
Initial name entry page for script:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> Simple HTML Form</title>
<style type="text/css" title="text/css" media="all">
label {
font-weight: bold;
color: #300ACC;
}
</style>
</head>
<body>
<!-- Script 2.1 form.html -->
<form action="handle_CHIS.php" method="post">
<fieldset><legend>Enter your Name/Phone Alias in the form below: </legend>
<p><label>Name: <input type="text" name="name" size="20" maxlength="40" /></label></p>
</fieldset>
<p align="center"><input type="submit" name="submit" value="Submit My Information" /></p>
</form>
</body>
</html>
Then the script (a php page) would then use the entered Name/Phone Alias
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>California Health Survey</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css">
</head>
<body>
<?php
if ( !empty($_POST['name']) ) {
echo "<p>Hello, my name is <font color=#FF0000><B>{$_POST['name']}</B></font>. I am calling for <font color=#000080><B>UCLA</B></font>. We are doing a scientific study about health in California. <br />
Have I reached you at _____?</p>\n";
}
?>
</body>
<div class="middle">
<div class="menu">
<li class="item" id='profile'>
<a href="#profile" class="btn">If Necessary</a>
<div class="smenu">
<a href="#">Our questions are for research purposes only and your answers are strictly confidential.)</a>
</div>
</li>
<li class="item" id="reassurance">
<a href="#reassurance" class="btn"></i>Reassurance</a>
<div class="smenu">
<a href="#">I want to assure you we are not selling anything.</a>
</div>
</li>
</div>
</html>
How would I do this so that EVERY study would not require an individual HTML and PHP page, but rather just ONE html for Name/Alias entry which would then populate into each script page? Would it require 2 PHP pages so that the first's "form action" would point to the second? I've only seen it done from one page to another page. Even the information I've come across has only been to pass it from one page to one other by referencing that specific page. I want to have the user be able to enter their name and have it populate in ALL scripts individually when clicked on my scripts.
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
CSS (Cascading Style Sheets) is a formal language for describing the appearance of a document written using a markup language.
It is mainly used as a means of describing, decorating the appearance of web pages written using HTML and XHTML markup languages, but can also be applied to any XML documents, such as SVG or XUL.
https://www.w3.org/TR/CSS/#css
HTML (English "hyper text markup language" - hypertext markup language) is a special markup language that is used to create sites on the Internet.
Browsers understand html perfectly and can interpret it in an understandable way. In general, any page on the site is html-code, which the browser translates into a user-friendly form. By the way, the code of any page is available to everyone.
https://www.w3.org/html/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.