Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JavaScript + PHP + HTML help, simple question Hi everyone! I have a simple probl

ID: 656125 • Letter: J

Question

JavaScript + PHP + HTML help, simple question


Hi everyone! I have a simple problem I need to fix. It's for a form I'm doing, where I have check boxes that once clicked, it throws in text to a text area. The problem that I'm having is that when I check or uncheck the boxes, and if I had typed in anything into the main text box, it would delete what I wrote, but post the lines I set. So is there any way for me to NOT have it delete the text I wrote after?

For example, two of the boxes are as follows:

Lower monthly payment Lower Rate / Term

[ x ] [ x ]

Then a text box below for 'additional goals'.

Here's my code:

<script> //adding checkbox values to additional goals box
var $ = function (id) {
return document.getElementById(id);
}
var updateGoals = function () {
var lowerRate = $("lowerRatePayment").checked;
var lowerTerm = $("lowerRateTerm").checked;
var cashOutDebt = $("cashOutDebt").checked;
var cashOutHome = $("cashOutHome").checked;
var message = $("additionalGoals");
if (lowerRate || lowerTerm || cashOutDebt || cashOutHome) {
message = "";
if (lowerRate) {
message += "Lower rate and payment. ";
}
if (lowerTerm) {
message += "Lower rate and term. ";
}
if (cashOutDebt) {
message += "Cash out for debt consolidation. ";
}
if (cashOutHome) {
message += "Cash out for home improvements. ";
}

}
else {
message = "";
}
$("additionalGoals").value = message;
}
window.onload = function () {
$("lowerRatePayment").onClick = updateGoals;
$("lowerRateTerm").onclick = updateGoals;
$("cashOutDebt").onfocus = updateGoals;
$("cashOutHome").onblur = updateGoals;
updateGoals;
}
</script>

-------------------------------------------------------------------- that's my javascript, here's my php/html code -------------------------------

<label for="additionalGoals" class="col-xs-3 control-label"><br><br>Additional Goals</label>
<div class="col-xs-9">
<textarea class="form-control input-lb" rows="5" name="additionalGoals" id="additionalGoals" placeholder="Type in additional goals the consumer has"
value="<?=$additional_goals;?>"><?=$additional_goals;?></textarea><br>
</div>
<div>

Explanation / Answer

check it out : and make the values accouding to it

<?php
if(isset($_POST['submit'])){
if(!empty($_POST['check_list'])) {
$checked_count = count($_POST['check_list']);
echo "You have selected following ".$checked_count." option(s): <br/>";
foreach($_POST['check_list'] as $selected) {
echo "<p>".$selected ."</p>";
}
echo "<br/><b>Note :</b> <span> Perform CRUD Operations.</span>";
}
else{
echo "<b> Select Option.</b>";
}
}
?>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote