'Hidden Pre Typed Text in Text area Showing in All Fields After Submission
I made a PHP request form and have pre-typed some text in the text-area and made it display: none; with its id and name attribute in the PHP form. I have other fields with input and textarea and their assigned id and name( for example id="othertexts" name="othertexts" I have made a hide/show text area, in which I have text area with pre-typed text with its own id="hiddentexts" name="hiddentexts" style="display: none;"
The problem I'm facing or having is when I user fills and submits the data in php form from othertexts field but when I get the email from the user I see data from othertexts and the from the hidden pre typed text from id="hiddentexts" name="hiddentexts"
im checking in my index.php
if(isset($_SESSION["data"]["GM Groups"])) { $gm_list = $_SESSION["data"]["GM Groups"]; } else { $gm_list = "";}
send_mail.php
$usersGMGroup = nl2br($_POST["acc_GMGroup"]); and then from where the index.php is pulling the data from hasData("GM Groups", $usersGMGroup);
I have tried and test most of the ways I found online but nothing seems to work
$(function() {
$("#groups").change(function() {
//GM Group
{
if ($(this).val() == "GM") {
$("#groups_GM").show();
} else {
$("#groups_GM").hide();
$("#acc_GMGroup").hide();
}
}
});
});
$('#groups').trigger('change');
html,
body {
min-height: 100%;
}
body,
div,
form,
input,
label {
padding: 0;
margin: 0;
outline: none;
font-family: Roboto, Arial, sans-serif;
font-size: 15px;
color: #666;
line-height: 19px;
}
legend {
color: #fff;
background-color: #095484;
padding: 3px 5px;
font-size: 20px;
}
h1 {
position: absolute;
margin: 0;
font-size: 36px;
color: #fff;
z-index: 2;
}
.testbox {
display: flex;
justify-content: center;
align-items: center;
height: inherit;
padding: 20px;
}
form {
width: 75%;
padding: 20px;
border-radius: 8px;
background: #fff;
box-shadow: 0 0 50px 0 #095484;
}
.banner {
position: relative;
height: 300px;
background-image: url("/New_Website/Walgreens Logo's/Walgreens New Logo/banner.png");
background-size: cover;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
.banner::after {
content: "";
background-color: rgba(0, 0, 0, 0.6);
width: 100%;
height: 100%;
}
input {
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 3px;
font-size: 17px;
font-weight: bold;
}
input {
width: calc(100% - 10px);
padding: 5px;
}
select {
width: 100%;
padding: 3px 0;
background: transparent;
font-size: 17px;
font-weight: bold;
}
.hiddenField {
display: none;
}
table.tb {
border-collapse: collapse;
width: 650px;
}
.tb th,
.tb td {
padding: 6px;
border: solid 1px #262626;
}
.tb th,
.tb td {
color: #262626;
}
.tb th {
background-color: lightblue;
}
textarea {
white-space: pre;
text-align: left;
width: 650px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="col-6">
<label for="userReqEmp">Requestor Name</label>
<input type="text" class="form-control w-100" id="userReqEmp" name="userReqEmp" placeholder="Type Here...">
</div>
<div class="col-6">
<label for="userNameEmp">Full Name</label>
<input type="text" class="form-control w-100" id="userNameEmp" name="userNameEmp" placeholder="Type Here...">
</div>
<div class="col-6">
<label for="userComEmp">Comments (Optional)</label>
<textarea type="text" class="form-control w-100" id="userComEmp" name="userComEmp" rows="7" placeholder="Type Here..."></textarea>
</div>
<div class="col-6">
<div class="row">
<label class="col-12" for="userEIDEmp">Employee ID</label>
</div>
<div class="row">
<div class="col-12">
<input type="text" class="form-control w-100" id="userEIDEmp" name="userEIDEmp" placeholder="Type Here...">
</div>
</div>
<div class="row">
<label class="col-12" for="userOIDEmp">One ID</label>
</div>
<div class="row">
<div class="col-12">
<input type="text" class="form-control w-100" id="userOIDEmp" name="userOIDEmp" placeholder="Type Here...">
</div>
</div>
<div class="row">
<label class="col-12" for="userDateEmp">Start Date</label>
</div>
<div class="row">
<div class="col-12">
<input type="date" class="form-control w-100" id="userDateEmp" name="userDateEmp" placeholder="Type Here...">
</div>
</div>
<div class="row">
<label class="col-12">Select Department</label>
</div>
<div class="row">
<div class="col-12">
<select id="groups" name="groups" class="form-control w-100">
<option value="">Select an option</option>
<option value="GM">GM</option>
<option value="AGM">AGM</option>
</select>
</div>
</div>
<br>
<!-- GM -->
<div class="row">
<div class="col-12" id="groups_GM" name="groups_GM" style="display: none;">
<h2>DC GM Group</h2>
<table class="tb">
<tr>
<th>Domain Group Access</th>
<!-- Title -->
</tr>
<tr>
<td>Wag-$Woodland<br>Managers</td>
<!-- Content -->
</tr>
<tr>
<th>Distribution List</th>
<!-- Title -->
</tr>
<tr>
<td>WoodlandInventory<br>WoodlandSrManagers</td>
<!-- Content -->
</tr>
<tr>
<th>Additional Access</th>
<!-- Title -->
</tr>
<tr>
<td>DCNet<br>AS400 (JOB-CAT-01)<br>VPN Non-Standard</td>
<!-- Content -->
</tr>
</table>
</div>
</div>
</div>
<div class="col-6">
<!-- style="visibility:hidden;" -->
<textarea class="textarea" style="display: none;" id="acc_GMGroup" name="acc_GMGroup" rows="5" col="2">
<u>Domain Group Access</u>
Wag-$Woodland
Managers
<u>Distribution List</u>
WoodlandInventory
WoodlandSrManagers
<u>Additional Access</u>
DCNet
AS400 (JOB-CAT-01)
VPN Non-Standard
</textarea>
</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
